databinding

ListView setting display text

I have a simple Person class: public class Employee { public String Name; public int ID; public TVShow(String employeeName, int employeeID) { Name = employeeName; ID = employeeID; } } I am populating a List (in this case named xmlHandler.employees) with classes containing the name and id of employees. I then...

WPF newbie - setting ItemsSource in XAML doesn't seem to work

I'm new to WPF and trying to figure out all this databinding stuff. When I do the following in my code, my ComboBox is populated when I run my application: public NewForm() { InitializeComponent(); Product.ItemsSource = Products; } public List<string> Products { get { return _productsComponents.Keys.ToList(); } } However...

DataBinding Not Working In My ASP.NET UserControl

<asp:Repeater ID="repFilter" runat="server"> <HeaderTemplate> <div id="posting" align="center"> </HeaderTemplate> <ItemTemplate> <div class="friends_area" id="record-"> <%# ((Ale...

Improving binding performance in WPF?

Hello All, I realize this question could be boiled down to "Why is my code so slow?" but I'm hoping to get more out of that. Let me explain my code. I have a class that implements INotifyPropertyChanged in order to do binding, and that class looks similar to this: public class Employee : INotifyPropertyChanged { string...

WPF DataGrid Binding to datatable

This is driving me nuts. I am creating a DataGrid in code and then binding it to a datatable. This is dynamic and the rows and columns will be different everytime the grid is created. Basically I loop through my datatable and create DataGrid columns for each column, like this: private static void CreateDataGridColumns(DataGrid datagr...

Why do some WPF binding fail against IronRuby properties?

So, lets say I have two nearly identical classes in C# and Ruby: C# public class Test { public Test() { ImageLocation = "http://www.ironruby.net/@api/deki/site/logo.png"; } public string ImageLocation { get; set; } } Ruby class Test attr_accessor :ImageLocation def initialize @ImageLocation = ...

Are "volatile" data bindings in Windows Forms possible?

Let's assume I'm implementing a Winforms UI where all commands adhere to the following pattern: interface ICommand { bool CanExecute { get; } void Execute(); } Buttons or menu items that trigger such a command should have the following set-up: property Enabled is bound to the command's CanExecute event Click is linked to the...

Winforms data-binding to business objects in a multi-threaded scenario without InvokeRequired?

For example, I've got a business object Person: class Person : INotifyPropertyChanged { string Name { get; set; } DateTime DateOfBirth { get; set; } } // ^ abbreviated for better legibility; implementation would be trivial And I've got some Winforms UI controls data-bound to an object of this class: Person somePerson = ...; n...

Specifying the records to be deleted from a database using the TableAdapter.Update method

I have been messing with this for quite some time now and it's getting less and less fun; I followed the MSDN guide for deleting a row from a datagrid. And it works for any row however I am not able to specify the row... essentially I can delete random rows by using the CurrentIndex parameter anything I try to be more specific gets me a ...

Exception when databinding a recently created Entity Framework object.

This possibly could be un-related to databinding or entity framework. But this is the scenario my problem is occurring in. This is my code, saving a new entity and then re-binding: Run run = new Run(); run.Distance = 111; rc.RunSet.AddObject(run); rc.SaveChanges(); GridViewRuns.DataSource = rc.RunSet.ToList(); GridViewRuns.DataBind()...

XML data binding in WPF

I am attempting to write an app that decodes some unsigned long values. Format of each value is represented in XML as: <Project Name="Project1"> <Message Name="a"> <BitField high="31" low="28"> <value>0001</value> <value>1010</value> </Bitfield> <BitField high="27" low="17"> <value>000111101</value> </BitField> <Bit...

Concurrency violation: the UpdateCommand affected 0 of the expected 1 records.

Hello everybody, I am new to c# and try to bind a datagridview to a mssql database in visual studio 2010. The databindings are OK and everything seems to work. Except for a few strange errors: I get the error in the subject after: updating the same row 2 times, deleting a new inserted row, after updating a row when an other row was d...

WPF, XML databinding into dependent/cascading ComboBoxes

I have an XML file with the following structure: <Products> <Product name="MyProduct1"> <Components> <Component name="MyComponent1"> <SubComponents> <SubComponent name="MySubComponent1"/> <SubComponent name="MySubComponent2"/> ...more SubComponent nodes... </SubComponents> ...

WPF, using XPath in XAML with XmlDataProvider to select nodes based on selected value in ComboBox

This question ties to my previous question but is more specific. Say I have two ComboBoxes, one populated with product names, the other empty. When a product is chosen, I want the second ComboBox to be filled with data related to that product. I have XML like the following: <Products> <Product name="MyProduct1"> <Componen...

in Flex DropDownList, is there a way to bind to a property of an item in dataProvider?

I have following code. <s:DropDownList dataProvider={_dataProvider}/> <fx:Script> private var _dataProvider:ArrayCollection = new ArrayCollection([{label:"one", data:1}, {label:"two", data:2}]); </fx:Script> I want to bind the data property of the selectedItem in the DropDownList. Is there a way to do this? ...

How to bind to a property of a property in WPF

I have a listview who's itemssource is a ObservableCollection of MyModel. I am trying to figure how to bind a textbox text's property to the Name property of the model's Owner property public class Person { public string Name { get; set; } public string Address { get; set; } //... } public class MyModel { public string...

Accessing a datatemplate control in WPF programmatically

In my WPF application I have a list of DocumentViewers which are bound to some property of an object. I add the object to a ListBox and programmatically apply a datatemplate which binds the property of the object to the DocumentViewer. This means the DocumentViewer isn't declared at all in the code, but I want to get at it to change a pr...

WPF, linking together two XML data sources in cascading ComboBoxes

I have XML in the following format: <Products> <Product name="MyProduct1"> <Components> <Component name="MyComponent1"> <Teams> <Team id="1"/> <Team id="4"/> </Teams> </Component> </Components> </Product> </Products> This is stored in an external XML file that is included via...

WPF Databinding with object source fails to update

Dear all, I have been struggling a while with this problem and read a lot but most of the examples are too simple. I am trying to bind a very simple ObservableCollection to a DataGrid. The super simple objects within the Collection are "SingleItems" which are defined like this: public class SingleItem { private String _name=null; publi...

Building a DataTable to a custom control

Are there any tutorials around for how one would go about creating a control that can be bound to a DataSet? I can't seem to find anything much about it on Google. I've tried this, where my control has a DataRowCollection property called Items (and a dataset called ds, containing a single table): ctrl.DataBindings.Add("Items", ds.Table...