databinding

EndEdit equivalent in WPF

I have a WPF Window that contains a TextBox. I have implemented a Command that executes on Crtl-S that saves the contents of the window. My problem is that if the textbox is the active control, and I have newly edited text in the textbox, the latest changes in the textbox are not commited. I need to tab out of the textbox to get the chan...

WPF: Is it possible to bind a Canvas's Children property in XAML?

I'm a little surprised that it is not possible to set up a binding for Canvas.Children through XAML. I've had to resort to a code-behind approach that looks something like this: private void UserControl_Loaded(object sender, RoutedEventArgs e) { DesignerViewModel dvm = this.DataContext as DesignerViewModel; dvm.D...

(WPF) Binding two classes to a control

I have two viewmodels. One which displays a collection of IPAddresses, and one which displays a collection of objects that has numerous parameters. One of these parameters is an IPAddress. So, I have another panel that binds to the properties of the second object. I would like a combobox to have the ItemSource set to the first object, bu...

DataGridView on WinForms throws exception when I delete a record.

Hello. I have not done a lot with WinForms so I wonder if someone could give me a little assistance with this. I have a DataGridView that is bond to a IList<>. When I delete a selected record from the collection (ILIST<>) I get the following exception: "System.IndexOutOfRangeException:Index 3 does not have a value" I think my binding ...

Which User Control event comes between data binding (other controls) and Render?

I'm currently building a user control that displays a message when a Repeater is empty. The idea is simple, provide the user control with the ID of the Repeater. When the user control is rendered look up the Repeater and check Items.Count. If it's zero then display the message. I would like to add one more feature though. I want to be ...

Creating a Report Model Project with a ODBC Data Provider, can this be done?

Hi I can create a normal SSRS Project and use a ODBC connection. But i cant create one with i want to create a Report Model Project??? Any idea why and how i can work around it? Thanks in advanced!! ...

DropDownList SelectedValue not binding properly

I have a DropDownList populated with a SelectList generated from (an anonymous type) that has two properties "CountryId" (int) and "Description" (string). I want the selected country in the list to be the defaultCountry. Countries = new SelectList(countries, "CountryId", "Description", defaultCountry.CountryId); where "countries" is a...

How Do I Get the Selected DataRow in a DataGridView?

I have a DataTable bound to a DataGridView. I have FullRowSelect enabled in the DGV. Is there a way to get the selected row as a DataRow so that I can get strongly typed access to the selected row's values? ...

Making a collection of WPF Expanders 'expand' exclusively, i.e. only one expanded at a time.

I have a ListBox containing a group of 'Expander' items, and what I would like to do is make the 'IsExpanded' property for each of them exclusive - i.e. if I have 10 Expanders in the ListBox, I'd like only one to be open at a time... Soo at present I have: <Window> <Window.Resources> <DataTemplate x:Key="NormalTemplate"> ...

WPF MenuItem Header and HeaderTemplate

I want to bind a list of KeyValuePair to a list of MenuItems. I thought I should use MenuIten.HeaderTemplate, but it didn't work. I only got blank headers. <MenuItem Header="Template" ItemsSource="{Binding Path=Samples}"> <MenuItem.ItemTemplate> <DataTempl...

Binding DataGridView to a List<>, some properties hsould not be shown.

I am trying to bind a DataGridView to a List, where MyObject looks like class MyObject { public string Property1 { get; set; } public string Property2 { get; set; } } //List<MyObject> objects; grid.Columns[0].DataPropertyName = "Property1"; grid.DataSource = objects; I want only one property to be displayed, but instead I get...

Is there a non-iterating control that allows data-binding syntax to be used?

Let's say I have a single XML node of content in my code-behind. I need to get some data out of the various nodes and onto a Web form. Traditionally, I would create a bunch of Literals on the page, then do stuff like this in the code-behind: MyLiteral.Text = myXmlNode.SelectSingleNode("/some/xpath").InnerText; This is fine and good,...

How to bind DataGridView with List<T> or BindingList<T>

I've done it one thousand of times and it works but now .... not :( Am I doing something wrong here because nothing is shown in grid ? namespace theGridIsNotWorking { using System; using System.Collections.Generic; using System.Windows.Forms; public partial class Form1 : Form { public Form1() { InitializeComponent(); ...

Using WrapPanel and ScrollViewer to give a multi-column Listbox in WPF

Hi I’m making a simple LOB app which loads data from an XML file and displays it in a list with a few buttons for editing. In my first attempt, everything was ok except that the list scrolled downwards in one long column. I would prefer the data to wrap so that at the bottom of the Window it starts a second column, and so on – if you r...

How to bind to a collection contained in an other project/namespace?

i did this: this.combobox.ItemsSource = Common.Component.ModuleManager.Instance.Modules; to bind the combobox to a collection, which is located in an other project/namespace. But i had to move the ComboBox into a DataTemplate. Now i need to do something like that: <ComboBox ItemsSource="{Binding Common.Component.ModuleManager.Instan...

Modelbinding of IList in ASP.Net MVC Final Release

There are a lot of examples on how to use the built-in Model-binding capabilities to automatically get a List of items. But they all refer to the Beta-releases of ASP.net MVC. It is also mentioned that there has been a change in this Model Binding but so far I was not able to find a good source on how it now works in the Final Release. A...

Custom gridview - bind using non-static function

I am currently attempting to implement a custom gridview interface to display data from an ObjectDataSource frontend to ASP.net membership. The asp.net code for the gridview is <asp:GridView id="grdUsers" HeaderStyle-cssclass="grid_header" RowStyle-cssclass="row" AlternatingRowStyle-cssclass="alternating" OnRowUpdating=...

Converting from String to custom Object for Spring MVC form Data binding?

I am using Spring MVC's SimpleFormController in conjunction with Spring MVC's form JTL to create a form to edit a Generic object. On my form I have a drop down where the user can specify a server via a drop down. <form:form commandName="generic"> <form:select path="server"> <form:options items="${servers}" itemValue="id" it...

Setting the aggregate of a property of the items in an NSArrayController as a dependent key.

Lets say I have an NSArrayController which contains items each with netCost and netProfit properties and I want to create a Total Percent Profit label (containing the sum of the profits divided by the sum of the costs). In the controller class with a reference to the array controller I've attempted to do this as follows: + (NSSet *)key...

WPF Listview databinding

I have a list view that has a column databound to a list.Count see below: <ListView.View> <GridView> <GridViewColumn Header="Contacts" DisplayMemberBinding="{Binding Path=Contacts.Count}"/> <GridViewColumn Header="Notes" DisplayMemberBinding="{Binding Path=Notes.Count}"/> </GridView> </ListView.View> The List i...