databinding

How can I dynamically create a list of label and textboxes in WPF?

Hi, I am trying, and failing, to create a list of labels and text boxes in WPF. I am a ASP.NET developer and the XAML experience is slightly overwhelming me at the moment... I have Apress' Pro WPF 3.0 book infront of me and finding it zero use... At the end of my process I want users to complete some questions that will be dynamic to...

ComboBox will not update its display list unless you change selections first.

Update: I checked the answer before I fully tested it still does not work. I updated the code below so you should just be able to paste in in to a empty winforms project and it should compile. UPDATE: I have found that if I change the selected item on the ComboBox to any other item it now behaves as expected (in my code below I would sw...

How can i bind a list of my custom class(Ex :Student) objects to a list view in WPF

How can i bind a list of my custom class(Ex :Student) objects to a list view in WPF ? My XAML markup for :ListView is here.I want to show the users in the Listview like a html table ListView Height="100" HorizontalAlignment="Left" Margin="27,98,0,0" Name="listView1" VerticalAlignment="Top" Width="320"> <ListView.View> ...

WPF, update TextBlock when CheckBox checked

I have a TreeView where each item has a checkbox. I want a TextBlock to be updated whenever an item is checked or unchecked in the TreeView. The TextBlock's Text should be bound to the CheckedVersions property on my DataContext so that when I read the CheckedVersions property, it gives me a string representing all the checked items in ...

Binding a combobox to a database and gridview

Hi, I am displaying a database table on a grid view and displaying a selected item's details in a detailsview. Here's the problem: There's a combobox in the detailsview and I want to display the added value's string on grid and I want the combobox to select this value. It will be possible to update, delete the selected item from grid o...

Data Binding in Combobox

Hi, I binded a database table's primary key to the selectedIndex of a combobox. the problem occurs where the primary key starts from 1 but selectedIndex accepts from 0. I mean, when I want to see the item with ID=1 in database, since it's listed as first element in combobox with index 0, it displays the second element in the list, which ...

[GRAILS] using different formats for BigDecimal in bindData

Hi, i have a class class Foo { BigInteger phase BigDecimal amount BigDecimal percent } and want to use bindData to map some user input. The user enters data in different formats for amount and percent i.e. : amount : 100.000,00 percent : 75,50% bindData parses this to amount = 100000 (in GERMAN...

How to bind combobox from datatable in winform having text and byte[]

How to bind a combobox with the datatable containing two columns. String and Image. When I am setting valueMember then an error is thrown. Argument Exception was unhandled Cannot bind to the new value member. Parameter name: value ...

Returning a DBNull for a bound MaskedTextBox whenever type validation fails?

I have a MaskedTextBox control with the mask "00/00/0000", the PromptChar "_" and the ValidatingType of DateTime, bound to a DateTime column in a database that can also accept null values. I'd like the user to have to enter either a valid date, or leave it blank (i.e. "__/__/____") for a DBNull. By using the TypeValidationCompleted eve...

How to set a data context for listbox item in listbox item template different from the one set as itemsource in listbox

...

Binding visibility of control inside listbox to a property not contained in the itemsource collection

I have a listbox with a datatemplate that holds a number of controls bound to my collection. I want to bind the visibility of one of the controls to a property defined in the class , an instance of which is set to datacontext in code behind.This property is not a member of collection which is item source of the listbox. How can this be...

How to bind/eval a field only for inserting/writing?

I got the difference between Bind and EVal from here. Bind will do both way reading and writing. And Eval do only reading. So any function only for writing? ...

asp.net mvc: binding complex objects

consider classic example: Product and Category editing Product in dropdown Id of Category is selected - Category mapped as object with all fields empty except Id when submitting Product edit form - validation gives an error: "Category name is required" (I have Required attribute on Category Name property) How deal with such errors if ...

WPF: Binding a ContextMenu to an MVVM Command

Let's say I have a Window with a property returning a Command (in fact, it's a UserControl with a Command in a ViewModel class, but let's keep things as simple as possible to reproduce the problem). The following works: <Window x:Class="Window1" ... x:Name="myWindow"> <Menu> <MenuItem Command="{Binding MyCommand, ElementNam...

GridView edit mode without objectdatasource

Hi Is is possible to force Grid view edit mode without using object data source, I set EditIndex, but the Edit template is never shown till I change the binding to ObjectDataSource Thanks ...

Retrieve all Data Bindings from WPF Window

I have a WPF form which has many controls on it. Many (but not all) of these controls are databound to an underlying object. At certain times, such as when the Save button is pressed, I need to check all the validation rules of my controls. Is there a way to do this programatically, WITHOUT hard-coding a list of the controls to be val...

Programmatically Set Asp Menu to Selected

I dynamically populate my Asp.Net Menu based on my Database: public class BasicHyperLink { public string Title { get; set; } public string Url { get; set; } } // For example, for the first menu // This is under mnu_DataBound: MenuItem parentItem = mnu.Items[0]; // Get first menu item foreach (BasicHyperLink link in getLinksLis...

Postbacks and Databinding -- Skipping through part of the page lifecycle?

Ok, I have a UserControl. In it is a textbox and other such things and a save button. I have this UserControl within a Repeater control in the ItemTemplate. Now whenever I first run it, it seems to work fine. When I change the contents of the textbox and go to save it however I get all sorts of null reference errors. The most confu...

Silverlight: Listbox bind to CollectionViewSource\List update on remove of item.

I have a Listbox that I binds to a resource (sort) CollectionViewSource in my XAML. Then in my cs code I set the CollectionViewSource source to List of objects (class level field) I then have "remove button" that checks the selected items in the Listbox and removes them from the List of objects (class level field). I thought the Listb...

Data binding of an abstract class in spring-mvc

I've went thru Spring documentation and source code and still haven't found answer to my question. I have these classes in my domain model and want to use them as backing form objects in spring-mvc. public abstract class Credentials { private Long id; .... } public class UserPasswordCredentials extends Credentials { private ...