databinding

C# Databinding SelectedIndexChanged call

I am using a SelectedIndexChanged function for a combobox to update the content of my DataGridview item. I have the combobox data bound to keep track of it's currently selected record. However, when I changed the combobox index it updates the datagridview as if the selected value was the same. This means once I have selected a different ...

c# databinding combobox change fields

I have databound a DataTable to a combobox, and I have a textbox that is also linked to a field in this same table. The Date field updates as expected when switched between records, but changing the value of the Date field causes the list entry in the combobox to change to System.Data.DataRowView. The record still selects fine. Here is ...

Databinding mode Explicit

Hi All, I've got a listbox that contains a list of objects (lets say addresses) The list box items source is bound to this observable collection <ListBox x:Name="listDetails" ItemsSource="{Binding}" ... Then i've got a text box, this is bound to the name fild of the current object <TextBox x:Name="textBoxName" Text="{Binding Name...

ASP.Net MVC view dropdownlist not being binded to model after submit (post)

I have a viewmodel class for a create view that consists of 2 properties different classes, and a list of selectitems (for dropdownlist). The dropdown list and the fields for one of the classes are always shown in the view,but the fields for the 2nd class are only shown if a specific option of the list is selected. (via a jQuery load an...

is there a good datasource example which binds to json (from a webservice)

Is there a good example (code) for a datasource which binds to json data from a remote webservice? Or is there another smart way to bind json formatted data against for instance a grid control? (either be it web or win forms) I'm asking for the source code, since that way it can be tweaked a bit to the json better ...

How to databind Enum value to a Boolean value?

So I have a main form with 3 controls whose Enable property I want to control using an enum. All these controls have a reference to the Data that contains the Enum value Level. enum Level { Red, Yellow, Green } So if it's Red, I want the RedControl to become enabled, if it's yellow, then YellowControl becomes enabled, etc...

WPF Collections and Databinding

I am new to WPF and trying to wrap my head around WPF's framework, what it does and does not do for you. To clarify this, I would like to know what is the difference between this: public List<MyCustomObject> MyCustomObjects { get { return (List<MyCustomObject>)GetValue(MyCustomObjectsProperty); } set { SetValue(MyCustomObjectsP...

Binding AJAX data to html list template

I'd like a functionality such as binding that is in silverlight, but this works for html and ajax calls. I retrieve an array of the following objects from the server which is the user information whose class looks like the following: public class User{ public int UserId; public string ImgUrl; public string UserName; } If ...

in asp.net mvc default binding, what control on the view would map to a boolean as a parameter in the controller action

in asp.net mvc, it seems like checkboxes bind to array of strings (if they are checked). is there any view control that will bind to a boolean in my controller action public ActionResult Go(bool isBold) { } ...

WPF - Can't display ObservableCollection in a window

I have an ObservableCollection that I can't seem to get to display in a window. Here is the code: The View Model: public class QueryParamsVM : DependencyObject { public string Query { get; set; } public QueryParamsVM() { Parameters = new ObservableCollection<StringPair>(); } public ObservableCollection<St...

Render bound wpf controls off screen to bitmap

I have a custom wpf control to do an arbitrary reverse image warp, that use a Viewport3D and custom matrix, and a mesh with an ImageBrush... I'm trying to render this to a bitmap entirely off screen. I am able to render a bitmap fine (I found to call .Measure() .Arrange(new Rectangle(...)) and .UpdateLayout()) before rendering, but the ...

How to automatically select first item in a bound silverlight listbox?

Using silverlight, I have a listbox with ItemsSource bound to an ObservableCollection which is updated asynchronously. I would like to automatically select the first item in the listbox as soon as the binding is finished updating. I can't find a good way to make this happen. I don't see any useful events to handle on the listbox and i...

ComboBox goes blank after data bound update, even though data updates successfully

Hello, I've got a problem with getting a ComboBox to operate as expected when data bound, and I am not sure where the problem is. In the code below, a ComboBox is created and given a data bound list of values, and is then data bound to the form. The idea is that the ComboBox should display the list of options, and when one is selected...

Subgurim .NET Google Maps Control ItemDataBound Event?

There doesn't appear to be an event when hooking up to an item in a datasource being bound. I need to hook up to this event to remove those that don't have valid coordinates. Any ways to work around this? ...

datagrid binding xaml

I'm trying to bind datagrid to xml: <StackPanel.DataContext> <XmlDataProvider Source="bill.xml" XPath="/Foods/Food"/> </StackPanel.DataContext> <DataGrid Width="190" Height="200" HorizontalAlignment="Center" VerticalAlignment="Top" Foreground="Black" ItemsSource="{Binding}"> <DataGrid.Columns> <DataGridTextColumn Header="Quantity" Fon...

Databinding a list (in an object) to a combobox in VB.net

VB 2008 .NET 3.5 I have a custom "Shipment" object that contains a list of "ShippingRate" objects. This list of "ShippingRates" is accessible through a property "Shipment.PossibleShippingRates." That property simply returns a copy of the list of "ShippingRate" for that particular Shipment. My UI layer receives a list of "Shipment" o...

How to convert enum to a bool for DataBinding in Winforms?

Is it possible to do this? I need to use: this.ControlName.DataBindings.Add (...) so I can't define logic other than bind my enum value to a bool. For example: (DataClass) Data.Type (enum) EDIT: I need to bind Data.Type which is an enum to a checkbox's Checked property. So if the Data.Type is Secure, I want the SecureCheckbox to ...

C# Databound winform control does not retain value unless you leave the field

I saw the answer in http://stackoverflow.com/questions/1060080/databound-winforms-control-does-not-recognize-change-until-losing-focus But this doesn't fully answer the question for me. I have the exact same situation. On ToolStrip_click, I go through all of my controls and I force "WriteValue()", but it still reverts to the previous v...

How do you handle Linq to SQL Foreign Key relationships in WPF DataBinding

I have been fighting this issue for some time so today I started a new project and simplified things to the basics. What I want to do is have a listbox, bound to a collection with a detail view of the selected item shown below. It all works fine except the items that refer to other tables simply show the foreign key. I was able to resolv...

Howto determine order of displayed columns in a datagridview binded to a datasource

Is there a way to determine the order of the columns displayed in a datagridview when binding it to a datasource whitch contains an underlying IList ? I thought there was a specific property attribute for this purpose but can't recall what it actually was. eg: public void BindToGrid(IList<CustomClass> list) { _bi...