databinding

MVVM- How can I bind to a textbox's SelectionStart and SelectionLength properties?

What would be the best way to do this? ...

How to access a named element of a derived user control in silverlight ?

Hello, I have a custom base user control in silverlight. <UserControl x:Class="Problemo.MyBaseControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlform...

Problem in DataBinding an Enum using dictionary approach to a combobox in WPF.

I have a Dictionary which is binded to a combobox. I have used dictionary to provide spaces in enum. public enum Option {Enter_Value, Select_Value}; Dictionary<Option,string> Options; <ComboBox x:Name="optionComboBox" SelectionChanged="optionComboBox_SelectionChanged" ...

How to update a custom dependency property when the datasource list changes

Hi We have a user control with a custom dependency property (DP). The DP is bound to an ObservableCollection. When a new item is added to the collection programatically, the databinding does not update the target DP. Why? We think it's because, unfortunately, in our case the target is not a ListBox or ListView, but a Canvas. The DP, whe...

Bind to a markup externsion property

Hi, I have written a markup extension which stores amongst others a help text. This help text is shown on the right side of the main window. This works fine. Now, I want to add a tooltip for every control. The content of the tooltip should be same as for the helptext extension. The XAML code: <ListView ctrl:ListViewLayoutManager.Enab...

Master-Detail configuration will not display details.

I have two data tables set up in a Master-Details configuration with a relation/Foreign Key "Ticket_CallSegments" between them. I also have two Binding Sources and a Data Grid View configured like this // // dgvTickets // (snip irrelevent data) this.dgvTickets.DataSource = this.ticketsDataSetBindingSource; // // ticketsDataSetBinding...

OnItemDataBound to set row values

Hi, I need to set a cell value to something dependant on other values which are only available during data binding so I'm using OnItemDataBound but it says I can't set the dataitem value. Any ideas how to do this? protected override void OnItemDataBound(RepeaterItemEventArgs e) { base.OnItemDataBound(e); DateTime date = (Date...

Databinding staticresource dictionary to treemap from wpf toolkit

Hi, I am trying to bind some diagrams to a dictionary of string, int, and I am using a view-viewmodel pattern. I have bound the dictionary already to a bar-diagram, but now I would like to bind it to the treemap control from the WPF Toolkit. It's not really documented anywhere online, except here for silverlight: http://blogs.msdn.com/...

Data Binding: multiple sources for one property

Hello, I want to bind one property to multiple sources. My reason for this are things like this: midpoint=point2.X - point1.X; //depends on two sources! How could this be realised? As far as I know it's not directly possible out-of-the-box? ...

MVVM pattern: ViewModel updates after Model server roundtrip

I have stateless services and anemic domain objects on server side. Model between server and client is POCO DTO. The client should become MVVM. The model could be graph of about 100 instances of 20 different classes. The client editor contains diverse tab-pages all of them live-connected to model/viewmodel. My problem is how to propaga...

How can I use a parent content control from a sub binding?

I have the following code currently: <DataTemplate DataType="{x:Type vm:SectionViewModel}"> <ScrollViewer> <ItemsControl ItemsSource="{Binding ViewModels}"> </ItemsControl> </ScrollViewer> </DataTemplate> <DataTemplate DataType="{x:Type vm:StringViewModel}"> <Grid> <Grid.ColumnDefinitions> ...

Rewrite HyperLinkField.DataNavigateUrlFormatString on the fly

I have a asp:GridView with a HyperLinkField. It's DataNavigateUrlFormatString property is set to View.aspx?id={0}&isTechnical={1} and DataNavigateUrlFields to ID,isTechnical Where ID is primary column INT and isTechnical - BIT, i.e. SQL Server representation of bool. So urls are being displayed like View.aspx?id=1&isTechnical=1 but I ...

How to deal with calculated values with Dependency Properties on a custom WPF control

To summarize what I'm doing, I have a custom control that looks like a checked listbox and that has two dependency properties one that provides a list of available options and the other that represents a enum flag value that combines the selection options. So as I mentioned my custom control exposes two different DependencyProperties, ...

When should I be cautious using data binding in .NET?

I just started working on a small team of .NET programmers about a month ago and recently got in a discussion with our team lead regarding why we don't use databinding at all in our code. Every time we work with a data grid, we iterate through a data table and populate the grid row by row; the code usually looks something like this: Di...

"Wrapping" a BindingList<T> propertry with a List<T> property for serialization.

I'm writing an app that allows users search and browse catalogs of widgets. My WidgetCatalog class is serialized and deserialized to and from XML files using DataContractSerializer. My app is working now but I think I can make the code a lot more efficient if I started taking advantage of data binding rather then doing everything manuall...

WPF TexBox TwoWay Binding Problem when ValidationRules used

I seem to have a problem with TwoWay DataBinding - my application has a window with a bunch of textboxes that allow to edit values of the properties they are bound to. Everything works well except for textboxes that also have a validation rule defined, in which case no text is displayed in the textbox when the window opens (binding back-...

Binding to a dictionary in Silverlight with INotifyPropertyChanged

In silverlight, I can not get INotifyPropertyChanged to work like I want it to when binding to a dictionary. In the example below, the page binds to the dictionary okay but when I change the content of one of the textboxes the CustomProperties property setter is not called. The CustomProperties property setter is only called when CustomP...

How to store an enum inside a DataColum of a DataTable and show localized text in .Net

I have to store on one DataColum of one DataTable an Enum containing some values. The enum is defined as follow: Imports System.ComponentModel Imports System.Globalization Public Enum FirmwareUpdateStatus <Description("updateNotExecuted")> UpdateNotExecuted = 0 <Description("updateSuccess")> UpdateSuccess = 1 <Description("...

Java beans binding: adapters?

Here's a really simple class: static public class Bean1 { final private String name; final private Bean1 parent; private int favoriteNumber; public String getName() { return this.name; } public Bean getParent() { return this.parent; } public int getFavoriteNumber() { return this.favoriteNumber; } public void...

Databinding a multiselect ListBox in a FormView control

I have a multiselect ListBox within a FormView. I can't figure out how to setup the databinding for it. I can populate the listbox fine. If the listbox was a single select I could use say SelectValue='<%#Bind("col")%>' and that works fine. Is there something that I can bind to for a multiselect listbox? I've tried manually DataBinding by...