databinding

How to get WPF DataBinding-to-an-object to work

In the following example I bind the XAML to a static object via ObjectDataProvider. When the user changes information, I want it to automatically reflect in the XAML. What I don't understand is: how do I perpetuate the object? do I have to create a singleton? in the click event, how do I access the "object that is being edited" eventu...

Is it possible to bind WPF Combobox.SelectedValue to multiple ObjectDataProviders?

Trying to determine if it is possible to bind the SelectedValue of a ComboBox to the inputs of multiple ObjectDataProviders with XAMAL Bindings. I looked at MultiBinding but that appears to be grouping multiple controls together, not exactly what I'm looking to day. I'd like to be able to have the ComboBox (locations) change the TextBl...

Update a binding that doesn't implement IObservable collection

I am trying to bind a list box to a collection. The problem is that the collection can change, but the collection doesn't implement IObservableCollection. What is the best way to force the binding to refresh? ...

Combining two observeable collection to a listbox?

Hi, I have two observeable collection both set to a class of properties. I am needing to combine both of those collections into one listbox. I have looked up at the Compositecollection class but it is not what I need. Ideally, I want the listbox to look like this... Think of this as a listbox control and each listbox item contains obj...

Why is INotifyPropertyChanged not updating the variables in XAML?

I want to simulate data changing in the model and having that data be reflected in XAML. As I understand I need to implement INotifyPropertyChanged. However, in the following code example, XAML displays the data from the customer only once but the date and time never changes. What do I have to change in the following example to make X...

Need help with Eval inside DataList

This should be simple enough, and I blame this primarily on my inexperience working with DataLists, Repeaters, etc. I have a DataList control which I am using to display the items in a shopping cart. Everything is going along fine with my binding of the different controls using Eval("ColumnName") until I get to the price column. My goa...

Binding ComboBox.SelectedItem in Silverlight

This one is driving me crazy. Here's the XAML: <UserControl x:Class="SilverlightApplication1.Page" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt; <Grid x:Name="LayoutRoot" Background="White"> <StackPanel HorizontalAlignment="Left" VerticalAl...

Change value in setter property when using WPF two-way databinding

I have a TextBox that is bound to a Text-property on an Entity-object. I'd like to be able to re-format the text the user enters in some circumstances - e.g. if the user enters "2/4" (a fraction) - I'd like to change that to "1/2". Via the “set-part” of the Text-property, I can change the value on the Entity-object, but that doesn't app...

How to display validation error on Image.Source?

I am binding an Image's Source property to a URI string property on the model: <Image Validation.ErrorTemplate="{StaticResource validationTemplate}"> <Image.Source> <Binding Path="LargeImage.ImageUri"> <Binding.ValidationRules> <ExceptionValidationRule/> </Binding.ValidationRules> </Binding> </Image.Sourc...

How can I catch a exception form ObjectDataSource.Updata()

The exception is throwed by database caused a conflicting by FOREIGN KEY. ...

When should I open and close a connection to SQL Server

I have a simple static class with a few methods in it. Each of those methods open a SqlConnection, query the database and close the connection. This way, I am sure that I always close the connection to the database, but on the other hand, I don't like to always open and close connection. Below is an example of what my methods look like. ...

What is the advantage of setting DataContext in code instead of XAML?

There seem to be two main ways to define DataContext in WPF: either in code like this: App.xaml.cs (taken from the WPF MVVM Toolkit template): public partial class App : Application { private void OnStartup(object sender, StartupEventArgs e) { // Create the ViewModel and expose it using the View's DataContext ...

Whats a good way to bind a repeater to a List<Person>?

If I have a List < Person > where person is defined by the class class Person { string Forename { get;set; } string Surname { get; set; } } And I bind it to an asp repeater control that looks like this: <asp:Repeater ID="Repeater1" runat="server"> <ItemTemplate> <asp:Label ID="lblForename" ru...

Binding ComboBox.SelectedItem in Silverlight (more)

Related to my previous question: http://stackoverflow.com/questions/855519/binding-combobox-selecteditem-in-silverlight I have a ComboBox bound like so: <ComboBox x:Name="PART_CommentaryList" HorizontalAlignment="Left" Margin="3" ItemsSource="{Binding Path=CurrentVideo.Commentaries}" SelectedItem="{Binding Path=Curr...

Is there a nullable datepicker that I can bind to?

I am looking for a datepicker like what microsoft provides, but it doesn't support null values, and since this is tied to a nullable field on a database that isn't acceptable. I found this one, but according to the comments at the bottom of the page it has issues with binding to a database. I also have one in my project that I inherited...

BindingSource.Filter doesn't work with '!='

I have a binding source and it has a column called Description and I want to exclude all rows that have their description set to 'x'. I have tried: bindingSource.Filter = "Description != ' + x; That doesn't work. Does anyone know how to do a is not comparison for the binding source's filter? I couldn't find any help on MSDN. ...

WPF -- simple checkbox binding question

Hello, While it is trivial to store a checkbox's checked state in a variable using the checkbox's Click event, how would I do it via databinding? All the examples I have found have the UI updated from some datasource, or bind one control to another; I want to update a member variable when the checkbox is clicked. TIA for any pointers....

In WPF, is there a way to bind to sibling properties?

I have a series of TextBlock and TextBox controls. Is there a way to apply a Style to the TextBlocks such that they can databind to the control immediately after them? I'd like to be able to do something like this: <Resources..> <Style x:Key="BindToFollowingTextBoxSibling"> <Setter Property="TextBlock.Text" Value="{Bindi...

Deleting from a subsonic collection bound to a winforms datagridview

I have a winforms application that i added a DataGridView bound to a subsonic collection via a BindingSource to it. The grid works fine for adding/editing (except for the display of the ComboBox column) but i can't get it to delete rows correctly from the database. If i delete a row from the DataGridView, i can't problematically determ...

ItemsSource type requirements for Silverlight 3 DataForm automatic Add/Delete buttons

What types can I bind to the ItemsSource property of the DataForm control in the Silverlight 3 Beta and automatically get the Add and Delete buttons to show on the control? I am making an application with RIA Services. I do have working add and delete methods in my domain service. I bound an EntityList of Contacts from the DomainContex...