databinding

How to refresh an ItemsSource with Silverlight 3?

I have a Silverlight 3 application which calls a traditional .NET Web Service (asmx) to get a list of records and then display it in a ListBox control (lstRecords.ItemsSource = myRecords). Any records could be added or updated or deleted at anytime and I would like my UI (records displayed in the ListBox control) to reflect the latest ch...

INotifyPropertyChanged and INotifyCollectionChanged in F# using WPF

I have an array of sample information that is constantly refreshed in a background thread. Currently I am constantly assigning this array to a datagrid's ItemsSource property using a DispatcherTimer. That works but it resets any visual locations, for instance if the user places his cursor in the middle of the datagrid the execution time...

How to ensure all changes in every controls applied to the DataSet before the data save to the database ?

When I develop using Delphi I always call DataSet.CheckBrowseMode() to allow bound controls to apply its pending changes to the DataSet. I've been looking for similar way in .NET I've tried // When the user press Ctrl-S // Apply any pending edit this.TheDataBindingSource.CurrencyManager.EndCurrentEdit(); // then save the data this.S...

Is it just me, or is WPF a mess of databinding and custom IValueConverters?

Seriously, it seems like every time I want to make my UI elements talk to each other, I end up coding a new, custom, IValueConverter :(. Someone tell me that I'm doing it wrong, please! Examples: I wanted a button to be enabled only if my textbox contained a valid URI. Great, time to code up a UriIsValidConverter! Oh oops, I also want...

Best practices for writing data access in ASP.NET

Ideally I would like to put all the code to access and fetch the data from the database in a separate utility files and all those methods at data binding times from the .net code behind file. The problem comes is when should the connection object be closed. For simple stuff, the helper method can close the connection but for things like ...

Data binding a WPF ListBox in response to a WCF service invocation

Picture, if you will, a Visual Studio 2008 WPF application with a single window containing a ListBox. This application contains a method, outlined below, that binds the ListBox to the contents of a database table. This application also happens to implement a WFC service contract, hosting said WCF service. The data binding method below...

Should my ViewModel contain a URI or a string?

This is somewhat of a followup to my previous question, where people pointed me in the direction of MVVM. I'm trying to understand exactly where the work is supposed to go in this framework. My view contains a textbox into which the user is meant to input a URI. As far as I see, I have two choices: Bind to a Uri object in my ViewMode...

WPF - Databind to a StackPanel using DataTemplates

I've modified my question since it has changed focus when trying things out. I narrowed the problem down to the following... I try to bind the selected Item of a TreeView to a StackPanel (or some other container that can hold User Controls). This container will then display a UserControl, depending on the type of the selected item. Her...

Using DataBinding values to update Width of a Control (WPF)

Hello, I created a user control and an associated view model. The properties "DisplayName" and "TimeIntervalLength" of the view model are displayed in the user control view DataBinding. Depending on those properties of the view model I want to update the width of my control. The width should be "TimeIntervalLength" but at least "Display...

WinForms Databinding DataGridView with ComboBoxColum

I'm trying to use DataGridView with a business object. Here's a simplified scenario: - call the object "Recipe", and it has a BindingList of a few Ingredient objects in the Recipe - I also have a "database", which is a BindingList of all available Ingredient objects I would like to display a DataGridView of all the Ingredients in the ...

Silverlight 3 and IMultiValueConverter

As you may know, Silverlight 3 doesn't support IMultiValueConverter and... I badly need it. A Web Service proxy which defines a class structure that I need to display in my UI. The object definition class has a few array property such as string[], int[], etc. When I bind these property to a TextBlock, the Text property of the TextBlock b...

WPF Tab Into Databound ItemsControl

In my WPF application, I have a databound TextBox and a databound ItemsControl. The contents of the ItemsControl is determined by the contents of the TextBox. I want to be able to type a value into the TextBox, press tab and enter the first item in the ItemsControl (created from the value in the TextBox ). The problem I am having is tha...

JSON.NET with GridView

Hi, I am trying to find a way bind Grid view to a JSON.NET parsed Linq to Json object simply am calling JObject yrs = SearchData(""); then use one property to be bound to Grid view GridView1.DataSource = yrs["businesses"].Children(); I cant find any resources for something like that neither binding directly work nor using Children...

wpf databind IsVisible to TabControl.SelectedItem != null

I have a stackpanel which I want to make visible only when SomeTabControl.SelectedItem is not null - how do I do this in WPF binding? ...

TypeCast within Binding Path

I would like to perform a typecast within a binding declaration within code (C#). Here's a quick chunk of code illustrating my situation: Binding aBinding = new Binding(); aBinding.Mode = BindingMode.OneTime; aBinding.ElementName = "FullPagePageViewGrid"; //aBinding.Path = new PropertyPath("((IPageLayout)Children[0])"); // What I'd like...

WPF Databinding problem of a WCF [MessageContract] class

Hi All, I've a class on the server [MessageContract] public class RemoteFileInfo : IDisposable, INotifyPropertyChanged { [MessageHeader(MustUnderstand = true)] public string _FileName; [MessageHeader(MustUnderstand = true)] public string FileName { get { return _FileName; } set { _FileName = val...

WinForms Combox - Adding item to a databound list and then setting that to be the selecteditem

I have this: cmbConnections.DisplayMember = "Name"; cmbConnections.ValueMember = "Index"; cmbConnections.DataSource = DBConnectionSettings.ConnectionList; All Ok! Now add new item to list: DBConnectionSettings.Connection c = new DBConnectionSettings.Connection(); c.Name = reply; c.Index = DBConnectionSettings.ConnectionList.Count + ...

ASP.NET ReorderList - Update Fails

I have an AjaxControlToolkit ReorderList bound by a SQLDataSource to a table with the following schema: OrgID MilestoneID Name Priority The Priority field is attached to the ReorderList as its SortOrderField. OrgID is specific to each user that logs in. The idea is that there is a different list of Milestones for each Org. I...

DataGridView.DataSource does not have new row from the grid (.NET)

I have a datagridview which is initially bound to an empty datatable. Then the first row is populated by setting values to the columns of the grid's CurrentRow.DataBoundItem row. I enter a new row manually by typing values in the last blank row. I hit a save button which does: DataTable dt = (DataTable)MyGrid.DataSource....... I noticed...

Binding new property on Custom Control to View Model.

Hi there, How do i extend an existing control (ComboBox in my case) to include a new property which i can bind to a property on my view model?? I have a Dependancy Property on the control's class as follows: public class MyComboBox : ComboBox { public static readonly DependencyProperty MyTextProperty = DependencyProperty.R...