databinding

Indirect binding to child collections in XAML

Hi folks, I am currently using a Linq template with SubSonic3 to create my models. I have a simple Member class, which has a collection of Notes. A Note class has a PublishedDate and Title properties. I have a UserControl which has a collection of Members for its DataContext. There are two ListBoxes and a bunch of TextBoxes and other c...

ASP.NET MVC Model Binding Related Entities on Same Page

This problem has been driving me crazy for several hours now... In my domain, I have 2 entities that are related to each other Sku and Item. Each sku can have many items. public class Sku { private readonly EntitySet<Item> items; public Sku() { items = new EntitySet<Item>(AttachItems, DetachItems); } public...

DataSource reflected after maximizing the window in wpf

Hey, This is really peculiar. I tried a simple data binding example program. I tried to bind a collection (IList) to a list box. When i alter the collection, the list box is updated only if i maximize the window. Here are the snippets, <ListBox x:Name="myBirthdaysListBox" ItemsSource="{Binding}"> <ListBox.ItemTemplate> ...

Do not fill DropDownList if upstanding UserControl isn't visible

I have page Add.aspx containing a number of UserControls: AddRequest.ascx, AddOperation.ascx, AddObject.ascx, etc. Depending on Request["type"] one control becomes visible. Each UserControl contains a number of DropDownLists that are being filled via SqlDataSource from DB. For example, types, statuses, currencies, etc. It seems that ap...

Databinding an ArrayList to a ListBox in VB.NET?

Hello, I'm working in VB.NET I have an ArrayList named Invoices populated with objects of the class Invoice. I'd like to data bind this to a ListBox so that as the contents of the ArrayList are updated and changed the ListBox updates. I've implemented a .ToString function on the Invoice class, I just don't know how I'd go about bindi...

Silverlight Tree view

Hi there, I am using the tree view control in my silverlight project. I use data binding for binding my model to the tree. This works perfect. After adding some features to the tree I ran into two problems: When I change a property on my Model, the tree does not get updated, even after my onproperty changed get called and also my con...

Data Binding using INotifyPropertyChanged (.Net)

Hi, I'm trying to find a good way to implement MVP in classic Winforms, and a couple of solutions I've come accros (e.g. http://codebetter.com/blogs/jeremy.miller/archive/2007/05/25/build-you-own-cab-part-3-the-supervising-controller-pattern.aspx) talk about using data binding between the model and the view. I've never used data binding...

Simple Databinding... PropertyManager does not have a refresh method?

Hi, I've setup data binding in VB.NET as follows with an Address business object and a Textbox. My issue is when I use AddressObjectInstance.Name = "Bob" the text box will update while if I do AddressObjectInstance = AnotherAddressObject the text field does not update. How do I force them to update properly? My Address Object: ...

DataBinding to a readonly property

Is it possible to bind a field (textbox) to a Property that doesn't implement a set? For instance I have an object that implements INotifyPropertyChanged with 3 fields: public decimal SubTotal { get { return this.subTotal; } set { this.subTotal = value; this.NotifyPropertyChanged("SubTotal"); this.N...

Binding to a RoutedUICommand that's not in the codebehind.

I have a static class which contains a RoutedUICommand that I would like to use in binding. public static class CommandLibrary { public static ProjectViewModel Project { get; set; } public static RoutedUICommand AddPage { get; private set; } static CommandLibrary() { AddPage = new RoutedUICommand("AddPage", "Ad...

Binding ComboBoxes to enums... in Silverlight!

So, the web, and StackOverflow, have plenty of nice answers for how to bind a combobox to an enum property in WPF. But Silverlight is missing all of the features that make this possible :(. For example: You can't use a generic EnumDisplayer-style IValueConverter that accepts a type parameter, since Silverlight doesn't support x:Type. Y...

XML databinding to TreeView (or Tab control), bind attribute based on different attribute

Hello, I have some xml: <Test> <thing location="home" status="good"/> <thing location="work" status="bad"/> <thing location="mountains" status="good"/> </Test> The leaves on the TreeView are the values of the status attribute; the nodes will be the value of the location attribute. ├──bad │.....└──work └──good .......├──home ....

How to set WPF string format as percent wihout multiplying by 100?

I have a textbox bound to a property in an object. I have setup the string format to be p0. However, when I enter 12 for example it is formatted as 1200% (multiplies by 100 and add % sign) How can i set the stringformat so that for exampe 20 is formatted as 20% ? My current control is : <TextBox Text="{Binding Path=MyCase, Validates...

Is it possible to create 0-code (trivial) app using data binding and Entity Framework? How?

I tried following the steps I describe below in VS 2010, but to no avail: Create new Windows Forms App. Project Add new empty ADO EDM to Project Add new entity Customer with scalar properties FirstName and LastName Generate db script Execute db script to create tables in db Add new Object Data Source based on EDM Model1 Select objec...

silverlight basic data binding

I cannot understand the Silverlight documentation on data binding. I seek a very simple example. Suppose I define a UserControl in a XAML file. The toplevel child of the UserControl is a Grid, of n columns and m rows. Within the Grid is a Rectangle. Like this: <UserControl.... <Grid ...> <Rectangle ...> The rectangle ...

Can MVVM gives any advantage if databinding is not used between view and viewmodel?

In MVVM, The ViewModel is a model for the view. And the real power comes in when we bind ViewModel to View in WPF. However, if third party control does not support data-binding (not supporting all functionality), in that case is it worthwhile to use MVVM? ...

When defining a binding purely in XAML, can the source variable be accessed in the code behind?

I'm learning binding in WPF. I can get binding to work when 1) the text of one control goes directly to the text field of another and 2) when I manually configure binding in the code-behind file. In the first scenario, I use purely XAML to configure the binding. Is it possible to access the source variable from XAML in the code-behi...

Accessing the root visual of a ContentPresenter hosting a DataTemplate

I'm working with the Adorner model with drag and drop, and I'm instantiating a DataTemplate through a ContentPresenter and adding it to the Adorner layer of my control/window. The problem I have is I need to register mouse events on the root visual element of the instantiated DataTemplate so I can change state and detect the drop in my B...

WPF ListBox that lays out its items horizontally

I'm trying to write a WPF application for displaying images from a selection. I want to display all of the available images in a banner along the top of the window, and display the main selected image in the main window for further processing. If I wanted the list on the Left of the window, displaying the images vertically, I can do thi...

WPF and databinding in a multi threaded ADO.NET app

I need advice and clarification please. I'm currently working on a monitor app that needs to show the contents of a database in a datagrid (I'm using the WPFToolkit grid btw). The grid binds to a table in my ADO.NET DataSet and it works fine. If I modify the DataSet through a button in my UI the grid updates and everyone is happy (bindin...