databinding

ComboBox.SelectedValue does not match displayed text when DropDownStyle = DropDownList in Windows 7

Let's say we have the following code in a Windows application: ComboBox comboBox = new ComboBox() { AutoCompleteMode = AutoCompleteMode.SuggestAppend, AutoCompleteSource = AutoCompleteSource.ListItems, DataSource = new string[] { "", "Ark", "Boat", "Bucket" }, DropDownStyle = ComboBoxStyle.DropDownList }; this.Controls.A...

Flex Data Binding

I'm trying to databind an object's property to a ComboBox's (editable=true) text property. This property is of type Number. If I bind using the inline syntax, it works: <mx:ComboBox text="{myObj.prop}"> If I bind using mx:Binding, I receive an error: <mx:Binding source="{myObj.prop}" destination="combobox.text" /> // 1067: Implicit...

C# how to implement databinding without Control?

Is there a simple way to implement databinding when neither of both classes is of type Control? In my case, I would like to bind a variable to a property of a custom ToolStripButton. EDIT for clarification: when binding to a Control, I can use Control's DataBindings collection. However, I am searching for a way to bind properties regar...

How do I databind to children of a child object?

Below is a sample of my object as XML. I had to take out the actual data because of Privacy, but you should get the gist of things. Currently I have binding working pretty well, but I cant get a box to fill with the necessary Granchild information. The list box is working correctly, and its probably a logical issue on my end that I am ju...

Is it possible to bind two source properties to one control property?

Using WPF, is it possible to bind two source properties, via one-way binding, to one control property (ie textbox.text)?? I'd like to have the user input a value in a textbox and have that value pushed to two different properties in the source datacontext. My workaround is to create a dummy property and have the setter set the two valu...

Silverlight databinding question

Let's say I have a Class called ModelBase public class ModelBase { public string Name { get { return "one"; } } } and I have a property named Model of type ModelBase. Now to the question how do I Bind to the Name property? The c# code would be this.Model.Name. I've been trying to get this to work a long time, can some on...

How do you bind the DataContext of a Control to the DataContext of its Content in WPF?

I tried this: Binding binding = new Binding("Content.DataContext"); BindingOperations.SetBinding(tab, DataContextProperty, binding); It isn't working. I don't know why. ...

DataBinding to a related boolean column, many-to-many relationship

This is a WinForms application. There is a many-to-many relationship between the rows in TABLEA and TABLEB. There is a record in TABLELINK for every row in TABLEA that is related to a row in TABLEB. Think "users" and "roles" or something similar, with each TABLELINK record indicating "user X has role Y." I'm browsing through TABLEA rec...

Getting all mapped Entities from EnitityManager

I have a piece of maintenance code that should grant select privileges to a certain user at certain points of time: grant select on A_DB.A_TABLE to READ_ONLY_USER; I want to do this for all tables. I could use select * from tab in Oracle or show tables in MySQL to get the complete list and then move on like that. But since I already ...

Accessing an ItemsControl item as it is added

In a previous post, I was advised to use a DataTemplate to render a group of Buttons and Labels, and it works wonderfully. The problem is that I have several of these groups of Buttons, and I would like to distinguish one group from another. I plan to use the AlternatingIndex to color each group differently, but that's not enough -- ea...

TableView or ScrollView for edit form?

I wonder which will be the best route for build edit forms on the iPhone, using a TableView or using a scrollview. I need: Support up to 15 fields (similar to contact app) The same behavior of safari forms, where is possible go back/forward among fields, and the form center the selected field and stay there when the user end the editi...

Data binding an Enum stored in an object into a Winforms ComboBox?

Anyone knows how to do this? I tried this, but it just populates this ComboBox which I already do. What I need is a way to get the combobox updated whenever the enum property on my object changes: DataObject.DataEnum but also get the above Enum updated whenever I change the selected item in the combobox. Is it possible to do this? ...

Binding enum values to RadioButton in Java

I am stuck in binding values from enum to RadioButton. Lets say I have a bean: public class ValueObject { public enum ValueEnum { FIRST_VALUE, SECOND_VALUE } protected ValueEnum value; } I want to create Swing RadioButtons where user can select one from these two enum values. As I use Netbeans as IDE I would also like t...

Binding Silverlight 3 description attribute of dataInput:DescriptionViewer

Silverlight's dataInput:Label and dataInput:DescriptionViewer controls provide a useful function through their ability to bind to a TextBox. Rather than hard-coding the text content of my labels and descriptions with System.ComponentModel.DataAnnotations.DisplayAttribute, I'd prefer to bind these attributes to properties of a class that...

Selecting a certain row from a dataset

Hi, I have a Dataset and want to display the containing rows in a WPF-Contorl. The problem is, that the control is sort of a circuit diagram. Thus I created a template to show the values and placed multiple instances of it in my circuit control. Currently the XAML-code in the circuit looks like this: <Label Content="{Binding Path=.[0]}"...

WPF binding based on comparison

There is a relatively simple thing I'm trying to achieve but I'm unsure how to do it. Basically, I have a CLR class as follows: class SomeClass { public SomeEnum Status; } public enum SomeEnum { One, Two, Three }; I've got a DataGrid that I'm binding an ObservableCollection<SomeClass> programmatically through the code-behind. In ...

ASP.net - Dynamically displaying controls

I am developing Quiz project. In DetailsView I want to display the Question and answers. The number of answers vary for question to question.Say example 1 ) C# Support (i) Generics (ii) LINQ (iii)EntLib 2 ) Find the odd one (i) DB2 (ii) Oracle (iii)MS-Access (iv) Sql Server (v) Javascript so i c...

databinding a Dataset to a listbox...Datatemplate needs to display from multiple columns

Hi, I was trying to figure this out for quite some time.I want a Databind a listbox with a Dataset.Simple as it can get.But my problem is that i want my datatemplate to display Columns from two tables,in the dataset.I have tried many samles..but everything i found just gives the dataset as datacontext and gives a single table as itemsour...

Silverlight DataGrid - Binding to a Collection of Collections of objects.

Problem: The data I'm trying to display is essentially a collection of collections of some object. So the rows can be any number, normal for a datagrid, and the columns are also any number. That's not so normal for a datagrid. Usually you have a set number of columns and your rows vary. The datagrid cell will be either a string or a valu...

C#/Linq combobox databinding

I'm working on a project where I'm using DataBindings to update certain fields based on currently selected field. I have a series of textBoxes which are databound to a combo box, which at present is currently linked to a table as a data source. However there is a relationship between the ID of two tables, meaning the combobox should be l...