databinding

DataBinding a DataGridview rows BackColor

I have a DataGridView that uses databinding, with manually created columns, and this works fine. However I want the rows' BackColor to be databound as well, and so far my attempts have hit errors. This is my latest attempt: dataGridFileTransfer.RowHeadersVisible = false; dataGridFileTransfer.AutoSizeColumnsMode = DataGridViewAutoSizeC...

WPF data-binding manual update

I have a List<Foo> from a non-WPF assembly which I'm attempting to databind to a WPF <ListBox>. Initially, the list items display correctly, but when I add a new item to the List<Foo>, the listbox doesn't add a list item. How do I tell the list box to re-bind / update / refresh the data and show the new item? (n.b. complete WPF n00b) ...

How do I filter a BindingSource with a LINQ query as the DataSource

I'm having trouble getting a filter to work on a BindingSource that is the DataSource for a DataGridView control. Basically, I have LINQ query that is the DataSource for the BindingSource and I would like to filter down the results. Below is an example of what I'm trying to accomplish. Dim query = From row In dataTable _ S...

WPF ObjectDataProvider and Mouse.GetPosition(IInputElement relativeTo)

I am attempting to bind the position of a camera to the relative position of a mouse's position in a 3D environment. Using an ObjectDataProvider I would imagine I can call this method and then bind to it, however, I'm not sure what to put in the ObjectDataProvider.MethodParameters, I'd like to reference the named Viewport3D from outside...

WPF ObjectDataProvider with static method GetPosition of Mouse

I am attempting to use an ObjectDataProvider to call the GetPositition method of Mouse, but am getting this error: System.Windows.Data Error: 34 : ObjectDataProvider: Failure trying to invoke method on type; Method='GetPosition'; Type='Mouse'; Error='No method was found with matching parameter signature.' MissingMethodException:'System....

How do I access the value of bound control on a non-displayed tab for validation?

I have created a dialog which contains 3 tabs. Controls on Tabs 1 & 2 have validation using the Validating() event. The user will mainly be working on Tabs 1 & 3, never displaying Tab 2 unless necessary. All controls on Tabs 1 & 2 are bound to a BindingSource object. From my observation, it appears that the bound controls are not ini...

Can you have different item-text and item-values when using ObjectDataProvider?

When setting the source of an items control (ComboBox, for example), is it possible to have the SelectedValue property be different than the text that is displayed. I have a ComboBox that I want to display only the time portion of a DateTime, and have the value of each item be the DateTime object itself. Thanks! ...

DataBindings.Add using IFormatProvider

I am trying to use an IFormatProvider to customize some databindings; however the IFormatProvider class is never being called. I put breakpoints at the begining of both functions in my custom formating class and neither are being hit through databinding. When I use my custom formating class with String.Format it works. I am using .Net ...

Nested listview databinding - property not found?

I have a listview, where I set the datasource in the code-behind - this works fine. When I add another listview (or databound control) to the listview's itemtemplate, and set the datasource for that control in the codebehind, the fields returned by the query seem to be unavailable to the nested listview; ASP.NET throws the following erro...

Why is Converter not called when Collection changes?

I made a CollectionToStringConverter which can convert any IList into a comma-delimited string (e.g. "Item1, Item2, Item3"). I use it like this: <TextBlock Text="{Binding Items, Converter={StaticResource CollectionToStringConverter}}" /> The above works, but only once when I load the UI. Items is an ObservableColle...

Silverlight Control Toolkit TreeView not rendering items

I'm trying to build a SL app with a TreeView in it. Here's my XAML: <UserControl xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit" xmlns:tkwin="clr-namespace:System.Windows;assembly=System.Windows.Controls.Toolkit" xmlns:basics="clr-namespace:System.Windows.Control...

WPF: Basic question about Dependency Properties

I have the following Xaml in a Window (ArtistInfo): <Grid> <TextBlock Text="{Binding Artist.Name}"></TextBlock> </Grid> And this is the code-behind for the same window (code simplified for question's sake): public static readonly DependencyProperty ArtistProperty = DependencyProperty.Register("Artist", typeof(Artist), ty...

WPF: Having hardcoded text with a binding in a TextBlock

In WPF, is there any way to have the Text property of a TextBlock to contain both hard coded text and a specific binding? What I have in mind is something along the lines of the following (ofcourse, the below doesn't compile): <TextBlock Text="Number of Fans: {Binding Artist.Fans.Count}"></TextBlock> ...

Question about ComboBox and Linq to Sql for Winforms...

Edit: More than a day. Still no answer! Is question not clear? I have ComboBox bound to BindingSource which in turn is bound to Linq Table. Also, ComboBox is filled from datasource which is a Linq Table. I want to assign new value to one of properties of BindingSource.Current whenever user selects item in ComboBox. I understood from M...

How to bind resources string to Xaml in Silverlight

How to bind resources string to Xaml in silverlight? ...

Bind Time to a DataGridView with a Date other than Today

We're creating a timesheets application. We're using a bound DataGridView to display the Task, StartTime and EndTime columns. The StartTime and EndTime are saved as datetimes in the bound SQL table. The StartTime and EndTime have their CellTemplate defined as follows, so that they only show the Time part: colStartTime.CellTemp...

How to force ListBox to reload properties of ListBoxItems

Is there any way, how to force ObservableCollection to fire CollectionChanged? I have a ObservableCollection of objects ListBox item source, so every time I add/remove item to collection, ListBox changes accordingly, but when I change properties of some objects in collection, ListBox still renders the old values. Even if I do modify so...

What do I have to change in my WPF databinding to get Listbox to show items?

I found this XAML in an example: <Window x:Class="TestDataTemplate123.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:TestDataTemplate123" Title="Window1" Height="300" Width="300"> <Window.Resources> ...

Why do I get "type reference cannot find a public type" on this databinding?

Why does the ObjectDataProvider not recogize "local:Customer" in this example? When I type <local: I get intellisense for "Customer" so it should work. I have no code-behind in this example. XAML: <Window x:Class="TestDataTemplate124.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http...

Does any one know of an exhaustive collection of WPF databinding examples?

It seems that every time I read an article on "how to do WPF data binding", it is done with some different variation, sometimes with DataContext, sometimes without, sometimes with Itemssource or both Itemssource and DataContext, there's also ObjectDataProvider, and you can have any of these in XAML or codebehind, or no codebehind and bin...