databinding

How can I bind to an enum in WPF with a "current" value

I have a simple .Net enum. I also have a view model object which has a "CurrentValue" property of the type of my enum. This property can be data-bound (the object implements INotifyPropertyChanged). Now I'd like to show one UI element for each value of the enum, in a specific order, and have the "CurrentValue" highlighted (bold). I would...

how to bind a list to a combobox? (Winforms)

I want to connect a binding source to a list of class objects and then objects value to a combo box can anyone suggest how to do it public class Country { public string Name { get; set; } public IList<City> Cities { get; set; } public Country() { Cities = new List<City>(); } ...

WinForms data binding - Bind to objects in a list

I need some help/guidance on WinForms data binding and I can't seem to get Google to help me with this one. Here is my scenario. Consider the following classes which is similar to what I need: public class Car { public string Name { get; set; } public List<Tire> Tires { get; set; } } public class Tire { public double Press...

Data Binding POCO Properties

Are there any data binding frameworks (BCL or otherwise) that allow binding between any two CLR properties that implement INotifyPropertyChanged and INotifyCollectionChanged? It seems to be it should be possible to do something like this: var binding = new Binding(); binding.Source = someSourceObject; binding.SourcePath = "Customer.Name...

WinForms multi-threaded databinding scenario, best practice?

Hi, I'm currently designing/reworking the databinding part of an application that makes heavy use of winforms databinding and updates coming from a background thread (once a second on > 100 records). Let's assume the application is a stock trading application, where a background thread monitors for data changes and putting them onto the...

How can I easily revert changes on a DataBound form?

If I have a form with controls DataBound to an instance variable object, is there a way to do revert changes that the user made, possibly by doing something like: myLocalObject = DataLayer.GetCurrentState(); and have the form's controls (bound to myLocalObject) automatically pick up the changes? Thanks! ...

Databound User Controls in .NET

I am looking for some information on how to properly implement data binding on a user created control. My UserControl contains a Textbox, a Button, and a MonthCalendar. I am able to databind to the Textbox inside of my user control, however, I want to implement the databinding on the UserControl itself, and not reference to textbox ins...

How to bind the selected value of a DropDownList

Data binding is all about declarative code, right? So I specify what I want with attributes, and the framework takes care of the rest. Unless I'm mistaken and data binding relates to S&M, right? So, why does the DropDownList control only provide binding fields for its data source, i.e. its list source, and not for its actual data fiel...

Databound numericupdown 'hiding' exceptiong thrown in bound property

I am having an issue where an exception being thrown from within a properties set accessor is not being caught by my global exception handler. I was having the issue in a larger application and after much gnashing of teeth troubleshooting the issue I tried, and succeeded in, replicating the issue in a simpler project. Following is the ...

Databinding items to Canvas

I have a userControl that contains a canvas. I would like to databind items to it so they are positioned automagically. Here's a great example that shows how to databind items on a canvas, but I want it to work on my specific userControl. (I believe it's not possible to specify a userControl in a ItemsPanelTemplate) ...

JibX: how to output the fields from a particular class into different parts of the XML

I've managed to get what I want when mapping with inheritance like this: ThisClassShouldntExist freeFlowMsg errorMsg BaseForm extends ThisClassShouldntExist function subFunction SpecificForm extends BaseForm address My binding.xml: <binding> <mapping class="com.struts.form.ThisClassShouldntExist" abstract="true"> <...

Updating multiple selected INofityPropertyChange objects in DataGridView

Hi all I'm working with a DataGridView (Windows Forms) with MultiSelect enabled which is placed in a User Control. I'd like to update all selected rows from outside the User Control by calling a public method that implements the following code: foreach(DataGridViewRow dr in dataGridView.SelectedRows) { MyBusiness business = (MyBusi...

WPF 2 ComboBox binding problem

I have the following problem: there is a class with a couple of string properties there is a collection of such class entities That collection is shown in tree on the left of some windows and details shown on the right. I'm binding string properties of selected node to comboboxes in details. First combobox always have the same Ite...

What's the best way to go about form validation in WPF (with databinding)?

I have several forms with many textboxes/comboboxes, and I would like to have the "Save" button disabled while at least one of the fields are invalid. I've been able to setup some custom ValidationRules, like so (textbox example shown): <Binding Path="Name"> <Binding.ValidationRules> <my:TextFieldNotEmpty/> </Binding.Val...

How can I bind certain properties belonging to a custom control?

If I have the following control: public partial class MyControl : UserControl{ public string MyControlText{ get { return MyTextBox.Text; } set { MyTextBox.Text = value; } } public MyControl(){ ... } } How can I bind to the "MyControlText" property when I place the control on one of my pages, like so: <lo...

.net Databinding - Referencing Anonymous Type Properties

I have bound an ASP.net GridView to a collection of anonymous types. How can I reference one of the properties of the anonymous types in the RowDataBound event handler? I am already aware of the way to cast the anonymous type like this: protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowTyp...

.Net Data Binding

I have been developing in Actionscript 3 / Flex Builder 3 for a while now and am pretty comfortable with data binding when developing those types of applications. Recently, I've gotten into some C# and for the life of me can't find a good reference on how to data bind. I was wondering if someone could give me some info on how to data ...

Winforms .Net Simple Databinding Not Working

I have a Winform with a very basic premise: modify 2 string properties of an object that is passed into it, then save it to disk when the form closes. I am trying to use databinding to bind the Text properties of 2 textboxes on the form to the 2 string properties of the object. But it isn't working. The textboxes never display the value...

Can I use a bindable string for a ComboBox prompt?

The following displays a ComboBox with the text "Select One": *This is pseudo code <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:ComboBox prompt="Select One"> <mx:dataProvider> <mx:Array> <mx:Object label="Obj 1" /> ...

Is it possible to refer to column names via bind variables in Oracle?

I am trying to refer to a column name to order a query in an application communicating with an Oracle database. I want to use a bind variable so that I can dynamically change what to order the query by. The problem that I am having is that the database seems to be ignoring the order by column. Does anyone know if there is a particula...