databinding

WPF: ComboBox DisplayMemberPath is suddenly not shown anymore ?

Hello, in my ComboBox I see 3 times this: MyNameSpace.ViewModel.CustomerViewModel ?? Actually this code worked but now don`t know what I changed: <ComboBox DisplayMemberPath="{Binding Path=CustomerName}" SelectedIndex="0" ItemsSource="{Binding CustomersViewModel}" /> Customers is a ObservableCollection The same code works fi...

DateTimePicker not updating dataset

I'm binding a DateTimePicker control to my dataset (which is linked to a database). However, unless the user changes the date on that control, the dataset seems to contain null for that entry (even though the Value entry of the control isn't null). I've done a bit of googling, and there's a lot of talk about people having troubles with...

WPF, databinding

Hi there In a given binding is it possible to specify the path on the source object? Seems like this could a void a lot of trivial converters.. Imagine this..: class foo { bool A int B } <ComboBox ItemsSource="ListOfFoos" SelectedItem="{Binding number, SourcePath=B}" /> ...

Problem when trying delete item from ComboBox.

I'm initialize my ComboBox using DataSource. After that when I'm trying to remove item from ComboBox I'm getting exception: "Items collection cannot be modified when the DataSource property is set." How can I remove items from ComboBox ? ...

Accessing Linq data in telerik grid ItemCreated method

Not sure if the title of this question makes sense, but here's my problem: I have a telerik grid bound to a Linq data object, however, I limit the fields returned: <IQueryable>filter = data.Select(x => new {x.ID, x.Name, x.Age}); I would like to access these fields in the ItemCreated method of the grid: protected void rgPeople_ItemC...

Why the databinding fails in ListView (WPF) ?

I have a ListView of which ItemSource is set to my Custom Collection. I have defined a GridView CellTemplate that contains a combo box as below : <ListView MaxWidth="850" Grid.Row="1" SelectedItem="{Binding Path = SelectedCondition}" ItemsSource="{Binding Path =...

strange Problem with WPF Textbox stringformat - Cursor moves back

I am using WPF 4.0 TextBox and binding. I am using StringFormat to format the number as currency. the XAML looks like this: <TextBox Text="{Binding Path=ValueProperty, ValidatesOnDataErrors=True, ValidatesOnExceptions=True, StringFormat={}{0:C}, UpdateSourceTrigger=PropertyChanged}"> </TextBox> Everything seems to work correctly excep...

C# Same DataSource + Multiple DataGridViews = Data Binding Issues?

Here's what I'm doing: I have (2) DataGridView controls DGV #1 is bound to the DataSet, DGV #2 is bound to a DataView of the SAME DataSet Now, what I'm needing to accomplish here is this: When a user checks a boolean column on the original DGV, the second DGV should now display the newly checked row also. The context is that the fir...

OneWay binding throws "TwoWay binding is invalid on Read only property"

This binding <tk:DataGridTextColumn Binding="{Binding Path=Id, Mode=OneWay}" Header="Sale No." Width="1*" /> Gives this error A TwoWay or OneWayToSource binding cannot work on the read-only property 'Id' of type . . . The "Id" property is indeed readonly, I thought though that Mode=OneWay would be sufficient. I'm tired and...

WPF How to bind to a specific element in the Collection

Hi, I want to make a binding to a specific element in the Collection. But I cannot figure out how to write the Binding. This is the code: public class MySource { .. public string SomeProp; public ICollection<T> MyCollection; .. } this.DataContext = new MySource(); <TextBox Text={Binding SomeProp} /> <TextBox Text={Binding FIRST_...

How do I bind to a property on the TemplatedParent of my TemplatedParent?

I'm creating a silverlight 4 custom control. The control's template is defined through generic.xaml. The control includes ItemsSource and ItemTemplate properties similar to an ItemsControl. The template includes (amongst other things) and ItemsControl which has its own DataTemplate, however inside that DataTemplate I have a ContentContr...

C# WPF provide a dependency property of a control to a converter in the control?

I have two objects, Culture and Translation, neither of which are complicated. Culture is like a simple CultureInfo, but with an extra field. Cultures likely won't change often, and there won't be many to begin with. However, there will be many Translations, and each Translation has a CultureID property. Translations each have a Trans...

Problem with static data binding in wpf

Hi. I'm relatively new to wpf and I quite don't understand binding yet. I want to have several combo boxes in my application with the same items. The basic solution would be to copy paste but that just isn't good practice. So I thought to put a static resource with the content I want and bind all combo boxes to it. It compiles and runs ...

DataTable won't DataBind with a DataTable.NewRow()

Is DataRow.NewRow() insufficient as the only row in a DataTable? I would expect this to work, but it doesn't. It's near the end of my Page_Load inside my If(!Postback) block. gridCPCP is GridView DataTable dt = new DataTable(); dt.Columns.Add("ID", int.MinValue.GetType()); dt.Columns.Add("Code", string.Empty.GetType()); dt.Columns.Add("...

What is the correct way to bind a textbox to an object.

Could somebody please take some time to show me a quick example on how to bind a text box to the property of an object from c# code? (I've tried to do it on my own, but i can't seem to get it right.) Thank you guys. I just spent an hour before i realized how stupid i am ( i was setting the wrong object as the biding source). Thank you ...

DataGridViewComboBoxColumn behavior: Odd differences between DataPropertyName, ValueMember, and DisplayMember?

VB.NET 2008 .NET 3.5 I hope my title isn't too misleading. I know what the three properties are/do, but have a question about their behavior that led me on a wild goose chase for a while. I have a DataGridView that is bound to a BindingSource. The BindingSource is bound to a list of complex objects. The DataGridView contains a Comb...

Binding different real time updated ObservableCollection to same userControl template

I have a UserControl with template property on, and a listView where i want to bind my collections. I use them for a multiple window interface. How can i bind on several different windows (child template), different collection which are updated in real time. My example is for a sniffer with multiple interfaces packet capturing. Thank u ...

Binding custom class property of an ASP.NET control from ASCX markup

I have an ASCX that inherits from a WebControl that has a 'CustomConfiguration' property of type CollectionConfigurationItem. This configuration gets set elsewhere in the code, so by the time it gets to the ASCX it is set up to how I wish to use the data. At this point I'd like to render out another control using this configuration, li...

Write Null/Nothing value with Databinding

I have extended a MaskedTextBox component to add some functionality. The text property of the extended MaskedTextBox is bound to a DateTime? property and the format of binding is set to a time format of "HH:mm:ss" (i.e. 24hr time). So that this masked text box will capture the display a time. The extra functionality I have added is to ...

Mouse events not firing when databinding to a Silverlight ContentControl

I am in the process of taking a Silverlight 4 UserControl containing a canvas which has a number of FrameworkElements on it and converting this to use databinding. The XAML for my original canvas was: <Canvas x:Name="panelDisplay" > <Rectangle Width="50" Height="50" MouseLeftButtonDown="Element_MouseLeftButtonDown" Stroke="Aqua" St...