databinding

Binding RadioButtonList to List<T> and setting DataValueField Proprty

Hello.. I have a class called "Answer" includes: int ID; String Text; And I have a list of them like this: List<Answer> myList; in the web page, I have RadioButtonList that I want to bind data from the list above, so I've done: AnswersButtonList.DataSource = myList; AnswersButtonList.DataTextField = "Text"; AnswersButtonList.Da...

Images in a List in WPF MVVM

I have a question regarding how to best accomplish something in WPF MVVM. I have in my ViewModel a series of integers. For the sake of example, lets call them: public int Yellow { get;set; } public int Red { get;set; } public int Green { get;set; } I also have some small images that are very simple: A Red circle, a Yell...

C# WPF - Binding Dictionary to DataGrid

Scenario Lets say I use C# WPF, and bind a Dictionary() to a DataGrids datasource. When I update the dictionary will the DataGrid automatically update and refresh? Also, will the DataGrid lose focus whilst doing this? In the event that updating the dictionary does not update the datagrid, how would I go about implementing this? Help ...

DataGridColumn Binding in code

Does anyone know how I can do the equivalent XAML binding in code? <DataGrid ... > <DataGrid.Columns> <DataGridTextColumn Binding="{Binding Description}" <=== set in code ** /> </DataGrid.Columns> </DataGrid> Cheers, Berryl === UPDATE ==== It looks like the method I have been looking for is Da...

C#: data-binding objects such as DataGrid

C#: if you bind a DataGrid object to a List object and set the columns to show properties of List's objects, will the DataGrid update when the data-object does? Is it advisable to data-bind DataGrids? Isn't it better for the programmer to control this process themselves? ...

How to bind a TableViewer to a java.util.List in Eclipse RCP

I'm trying to bind a TableViewer to a models = List<ModelObject> , but I don't really get the hang of it. The binding should be possible via master-detail and a databinding context (DataBindingContext), so that I'm able to write the changes of the list (and its elements) to the model only on request (dbc being set to POLICY_ON_REQUES...

Displaying a large collection in a DataGrid

The amount of items in collection: ~100k The amount of field displayed in columns: 4-10 The problem itself - the collection is taken from a database using EntityFramework. It takes about 10-12s on dev computers to load and materialize all the required data. Yet another thing that comes up is that the same collection can be bound to seve...

How to change properties of a class in the ObjectDataSource Updating-Event when the update method accepts the business class as parameter?

I have the following situation: My business class: public class Foo { public String A {get;set;} public DateTime B {get;set;} // .. and other properties like public String Intern {get;set;} } I'm binding that Item to a DetailsView in Editmode. (I bind a List containing a single object of Foo, becuase I do recall that I can only b...

FormatException in DetailsView, which uses dynamically inserted value for Item of DrodDownList

Hello! I use DetailsView with ObjectDataSource to insert entry in database. DropDownList ddl_kinds is bound to some field. I complete dropdownlist dynamically. Last listItem of dropdownlist has TextField "Null value" and ValueField "0". But when I choose this item in DetailsView and try to send form, FormatException is thrown. There is...

What is wrong with this simple binding?

I'm trying to bind a list box in the simplest manner possible with the goal of understanding binding a little better. All examples I see online show data template, and I don't want to get that complicated yet. I have a collection of objects. These objects have a property of string type, and that's what I want to show in the list box. ...

Extjs Bind TreePanel static data to FormPanel

Hi, This may be obvious but I can't figure out how to bind a static json object to to a FormPanel in extjs. I am new to ExtJs so I'm still learning. I have a TreePanel with various additional attributes contained on the node.attributes object. When a node is clicked id like to display the data in a form. Below is what I have. The data d...

Strong typed Windows Forms databinding

Edit: I prefer this solution I found eventually in Google's cache (it has been deleted from the author's site) as it only needs one type specification and does it in a way I haven't seen before. I don't know why the original author deleted it. // Desired call syntax: nameTextBox.Bind(t => t.Text, aBindingSource, (Customer c) => c.FirstN...

WPF Binding to Child Collection

Hello, if the parent's datasource has a child property that is a collection (let's say it is called ChildCollection) is there a trick to reference it? So, this code sample is basically what I am attempting to do. But when I use this approach I do not get any data to my child controls. <UserControl> <UserControl.Resources> ...

WPF - Bind to Item Index from within ItemTemplate of ItemsControl?

Is there a way to bind to the ItemIndex from within the ItemTemplate of an ItemsControl? For example: <ItemsControl ItemsSource="{Binding Path=ItemList}"> <ItemsControl.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding Path=ThisItemsIndex}" /> </DataTemplate> </ItemsControl.ItemTemplate> </Items...

Two way binding to a global 'boolean' in XAML?

There's quite a lot out there regarding binding a XAML StaticResource, such as a string constant to a XAML control. However I cannot find a good way to do two way binding in this scenario. I want to bind a global boolean to a checkbox which enables 'debugging' mode, that toggles visibility of certain things throughout my application. I...

Howto immediately update TextBox after correction of bound property?

Hello, i've made a binding from a TextBox to a Property. If the user write a date-value into the TextBox, it should be automatically corrected. f.e.: 20.01.10 -> 20.01.2010 The correction is done in the propertys set-block: public String DateOfBirth { get { if (patient.DateOfBirth != DateTime.MinValue) ...

How to use ColumnName in GridView control to hide some columns

I want to hide few columns of a gridview before they gets displayed. I want to do it by create a common function which can be used by multiple controls. I am using an extension and would like to know how it can be done. Here is my code protected void btnStandardView_Click(object sender, EventArgs e) { _viewTypeDl = new ViewTypeDL()...

How to bind dropdownlist in EditItemTemplate in FormView control?

Hi there, Using Visual Web Developer Express 2010 with ASP.NET 4.0. I have a FormView and I want to set a default value from the database. I can't get it to bind to the value in the database. My FormView looks like this: <asp:FormView ID="frmOrderDetails" DataSourceID="sdsFormOrderDetails" runat="server" DataKeyNames="orderId"> <...

WPF: Dependency Properties and DataContext

I was working on creating a reusable custom control (not a user control) in WPF. I created the XAML in the Themes/Generic.xaml file and I setup the "lookless" functionality in the control's CS file: AddressField.cs using ...; namespace MyNamespace { [TemplatePart(Name = AddressField.ElementAddress1TextBox, Type = typeof(TextBox...

Set Binding Source DataSource to Generic IList<> Error

If I want to set the DataSource property on a BindingSource to an IList<>, do I need an explicit cast as the following error message says or am I doing something wrong? interface IView { IList<OrderItems> BindingSource { get; set;} } public partial class Form1 : Form, IView { public Form1() {...