databinding

WCF Data Contracts DTO

In my application I am making a service call and getting back populated WCF Data Contract object. I have to display this data in a grid. Is it good practice to bind the data contract to the grid ? Josh ...

Binding WPF ComboBox to List<MyClass> where MyClass doesn't have properties, just methods.

Hi, I want to bind a combo box to a list of Device, List. I use, m_ctrlCB.DataContext = m_List; m_ctrlCB.DisplayMemberPath = "ToString()"; m_ctrlCB.SelectedValuePath = "ToString()"; // do I even need this? I don't have any properties in Device to bind to and it's not my class. However, they do override ToString to something that i...

Binding Scope - Styles & Templates

I've got a custom ItemsControl in my project and I'm trying to write a style for it that combines a static list of items with a list of items on a Dependency Property on the control itself. Here is the respective XAML in my Resource Dictionary: <x:Array Type="{x:Type System:Object}" x:Key="Static_CloudItems"> <Button>One</Button> ...

How can I access a view property from my ViewModel ?

I have a ViewModel whose properties are bounded to from the View (XAML file). I also have a property "StaticText" in the code behind file. how can I access the property "StaticText" from inside the ViewModel ? as suggested by Cameron, i've created a dependency property in my View : String textToTest="I am just testing ."; pu...

How to bind data to a ListBox in a ControlTemplate?

Hello Stackoverflow users, What I am trying to do is to create some sort of "rooms"(like a chat group, a sharing center or whatever you want). All the room are created the same way, but each one of them contains different informations. Each of these rooms is contained in a TabItem. I managed to create dynamically all the Tabitems, to gi...

C# DataGridViewComboBoxColumn binding problem

Hey everyone! I suppose this is my first post on StackOverFlow.com :-) I've been having this problem for a while. To make it all simple, suppose we have 2 database tables named "books" and "categories" with the following schema: books(id, title, catId) categories(id, catName) Obviously the "catId" field in the "books" table is a...

Use DataTemplate in WPF with a mocked object.

I have following xaml code: <Window x:Class="MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" DataContext="{Binding MainWindow, Source={StaticResource Locator}}"> <Window.Resources> <DataTemplate DataType="{x:Type vm:...

How data driven applications are built generally

I am a newbie .net programmer learning WPF for past one month. One thing I am confused from the start is how real time data driven applications are built. I started with a basic application where I required to bind data to a datagrid which would have some 10 columns approxly. The common way of data binding I have seen in all the tutorial...

Diagnosing performance problems with databound WPF ComboBox

I've been battling a "slow" WPF ComboBox this morning, and would love to see if anyone has tips for debugging such a problem. Let's say I have two ComboBoxes, A and B. When A changes, the items in B change as well. The ComboBoxes each have their SelectedItem and ItemsSource databound like this: <ComboBox Grid.Column="1" ItemsSource="...

Overriding DataBind on User Control, caveats?

I've a custom property on a user control which has multiple state/modes. If this property is set in the parent page: I would like for my control to update automatically. Using the property in the page load does not work because it is not initiated. I can imagine 3 methods to do this: On the property, I could add a code block that woul...

In XAML is there a way to default the UpdateSourceTrigger to PropertyChanged?

In XAML (or code) is there a way to default the UpdateSourceTrigger to PropertyChanged for all bindings? http://msdn.microsoft.com/en-us/library/system.windows.data.binding.updatesourcetrigger.aspx http://msdn.microsoft.com/en-us/library/system.windows.data.updatesourcetrigger.aspx ...

Why doesn't BindingList(Of T) have AddRange Member?

I think the title pretty much captures my question, but a little bit of background follows: When a form I have loads it adds a couple of thousand (30k odd) objects to a binding list. When my application loads the first time it takes multiple seconds (around 10 or so from memory) for it to loop through the list of objects and add it to t...

'Databinding complete' event for Silverlight 4.0 DataGrid?

I have a DataGrid that I have bound to a property: <cd:DataGrid Name="myDataGrid" ItemsSource="{Binding Mode=OneWay,Path=Thingies}" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto"> ... When the Thingies property changes, once all rows in the DataGrid have been populated with the new contents o...

c# combobox binding to list of objects

Hello, Quick question, is it possible to bind a combobox to a list of objects, but have the selectedvalue property point to the object, not a property of the object. I only ask because we have some Business Objects which have references to other objects - such as a 'Year' object. That year object may need to be switched out for another...

Problem with nested StackPanels and DataContext inheritance in Silverlight 4

I have a problem with nested StackPanels. If I define StackPanels like in the code below, button binds to command (MVVM and command pattern) but doesn't react on button click (command function is not called). When I put stackPanel4 on second position (below stackPanel3) everything works ok. When I move stackPanel4 on the last position (I...

PropertyChangedEventHandler always null in silverlight binding

Hi there, I've been trying to resolve this issue for some time. I'm trying to bind a TextBlock's text to a string property using the INotifyPropertyChanged interface. For some reason the PropertyChangedEventHandler is always null when the value of the property is changed thus the target never gets updated... Any suggestions? Code below: ...

OneWay binding for ToggleButton's IsChecked property in WPF

I have a ToggleButton with its IsChecked property bound to a property using a OneWay binding. <ToggleButton Command="{Binding Path=SomeCommand}" IsChecked="{Binding Path=SomeProperty, Mode=OneWay}" /> The SomeCommand toggles the boolean SomeProperty value, and a PropertyChanged event is raised for SomeProperty. If I change So...

Telerik RadGrid bound to web service without Linq

I want to bind a Telerik RadGrid to a web service without using Linq. In all examples I can find, the web service has to return a List(Of MyObject); I've tried this, and it works great. However, the table I'm binding to may at runtime have additional columns, or columns may have different data type, so I can't use a static MyObject class...

What is the best way to databind a listbox inside a custom control

I have a simple custom control that boils down to a label and a listbox. Selections in the listbox are reflected in the label as comma separated values. My question is what is the best and simplest way to make the page developers experience of working with the custom control exactly mimic the experience of working with just the listbox...

Combine my Attributes on a Linq to SQL Entity Property

I have a Linq to SQL dbml.cs file with this in it: [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PantsName", DbType="VarChar(248)")] [global::System.Runtime.Serialization.DataMemberAttribute(Order=3)] public string PantsName { get { return this._PantsName; } set { if ((this._PantsName != value)) { this._PantsName = val...