databinding

How to apply single item converter to ItemSource property?

I set up ItemSource for the ListBox with converter: <ListBox Name="FunctionsListBox" ItemsSource="{Binding Path=Functions, Converter={x:Static app:CreatorWindow.FunctionConverter}}"/> However this looks for me ugly, because converter converts entire collection -- I would prefer more versatile converte...

WPF TextBox Databinding woes >:-(

What should be one of the most simpliest form of databinding, is now causing me great amounts of grief. In my XAML, I have something as such: <TextBox Text="{Binding Path=Speed}" /> Then in my matching .cs file, I have a property as such: public int Speed { get; set; } But they aren't binding in harmony and I don't understand why...

Databinding techniques

How do I bind a textbox to one to many valued columns. my table: id name statusid typeid assignerid ... I would like to bind all these to textboxes. Some of the options are: i.make joins and form resultset accordingly<1, tom, new, query, george> ii.bind the sub table values to combobox and set selected value property accordingly are...

Binding parent container props to content child control in Silverlight

Example: <UserControl x:Name="userControl" <StackPanel x:Name="container" Margin="0"> <TextBox Text="{Binding Path=SettingValue, RelativeSource={RelativeSource Mode=Self}}"/> </StackPanel> </UserControl> UserControl contains SettingValue dependency property, TextBox doesn't, so this example won't work. I could've don...

Testing for null, inline, on an ASP.net Bind() call

I've got a bit of code that I started to manage, and it's begun to fail due to some data missing in the database. This case could happen in the future, so I'd like to gracefully handle the nulls in the front end. Here's the current code: <asp:DropDownList ID="ddlContact" runat="server" SelectedIndex='<%# Bind("contactInfo") == null ...

WPF MVVM data binding broken after page navigation

I have a Page within a WPF navigation-style application that displays search results. The page contains several data-bound controls. The page itself works fine; it performs the search and returns results. The data-bound CheckBox controls work properly. But if I click a result link and then click the back button to return to the results ...

Binding with Relativesource --wpf

Hi, I have a short question: I have a datagrid and binded it to something. Then I put a combobox in a column and binded it to another source by ItemsSource="{Binding DataContext.Users, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type DataGrid}}}" Now I want to use datagrid's source again, in the combobox again.That...

Why does this binding display a class name?

What might cause the value of a Silverlight 4 DataGridTextColumn.Header to display as System.Windows.Data.Binding rather than the resolved bound value? It seems like a ToString is happening somewhere that displays a class name rather than the formatted value of the class. The binding looks like this Header="{Binding Path=Dummy,Source={...

How to handle ObservableCollection<> result from a parallelized Task in MVVM?

Hi. I am gathering data in a separate Task and I want to data bind the result to a GUI component using an ObservableCollection<>. So my code goes something like this: private ObservableCollection<MyItem> _items; public ObservableCollection<MyItem> Items { get { return _items; } set { if (_items.Equals(value)) { retur...

Advanced manipulation on automatic data binding in .NET, architectural problem

I have application with following data flow: SqlDatabase -> SqlDataAdapter + SqlCommandBuilder -> DataSet -> DataGridView All conversions and bindings are automatic. This is all simple and functional and I can load all kinds of databases with simple code. Problem is with BLOBs, they are treated as Image in DataGridView. My question is...

Binding a cell object's property to a DataGridCell in WPF DataGrid

Using the WPF DataGrid I have the need to change various display and related properties of a DataGridCell - such as Foreground, FontStyle, IsEnabled and so on - based on the relevant value of the cell object property. Now this is easy to do in code, for example (using an Observable Collection of ObservableDictionaries): var b = new...

Null Reference Exception when binding DataTable to GridView

I've been working on this for a few days now I every time I come back to this problem I just don't see why it's not working correctly. I'm trying to bind a DataTable to a GridView control that I create Dynamically. I create the GridView control, add it to a table, and then assign the DataSource property to my DataTable. This is the cod...

WPF Chart Series Dynamic Databinding

How do I go about binding a chart series to a datasource where the data changes? I will of course need the chart series to reflect the changes to the underlying data. I need a fresh angle. ...

Silverlight Binding Path Dynamically

I've spent hours on this so any help is much appreciated: I have a TextBlock inside a DataTemplate which has an ItemsSource already set. I want to bind the Text of the TextBlock and set the Path to whatever the path is of a different object in code-behind. I've tried everything I can think of even this: <TextBlock Text="{Binding Path='...

How to set SelectedValue of a List bound Combobox with an item not available in the List

I have a List with objects of class Person. I have set the list as a DataSource of a ComboBox. Now when I set the SelectedItem of the ComboBox a new instance of class Person, the SelectedItem never sets. Why it happens? public class Person { public Person(string name, int age) { Name = name; ...

How to separate diffrent database values when they have the same name?

I Have a problem to get the right "Name" from the database, The result is the same on all the "Name". I get the information from the same stored procedure. Are there a way to specify witch name I look for? ex. Text='<%#Eval("tblBrand.Name") %>' Gets the name in tblBrand. But that dosent work. <asp:Label ID="lblProductName" runat="server...

Having trouble binding the Visibility of a ContentPresenter in WPF

I have the following XAML: <UserControl.Resources> <DataTemplate x:Key="ExpanderTemplate"> <Grid> <Rectangle Stroke="Black" StrokeThickness="1" Width="10" Height="10" Fill="White" /> <Rectangle Stroke="Black" StrokeThickness="1" Width="6" Height="1" Fill="Black" /> <Rectangle Stroke="Black" StrokeThickness="...

Shuffle DevExpress GridControl DataSource.

Hello, I need to shuffle the GridControl's DataSource. I use this property in a UserControl: private List<Song> _songsDataSource; public List<Song> SongsDataSource { get { return _songsDataSource; } set { _songsDataSource = value; if (!value.IsNull()) { SongsBindingList = new BindingList<...

Any default converters for WPF?

i read that i can use data converters in binding like ... <TextBlock Text="{Binding Converter={StaticResource PositionConverter}}" /> from here but i wonder if there are any "in-built" converters. because creating converters to just output say 2 decimal places etc seem troublesome. i just thought that there must be sometime inbuilt t...

Very simple databinding crashes / GlobalOffsetZ / Windows Phone

HI there, I'm playing around with the new Windows Phone 7 SDK and have a prob here... xaml <Rectangle Fill="#FFFFEA00" Stroke="Black" Height="300" Width="300"> <Rectangle.Projection> <PlaneProjection GlobalOffsetZ="{Binding Path=Test}" /> </Rectangle.Projection> </Rectangl...