wpf-binding

How to reffer XML data to IValue Converter?

I am trying to build navigation model where pages are loaded into frame by selection listbox items of the ListBox and also by clicking 'back' / 'forward' buttons. Listboxitems with UriSource associated are generated from XML. While cliking 'back' / 'forward' buttons, I need to make the selected item in the ListBox be the current with the...

How can I implement this one line XAML programmatically in WPF code?

Hi, How can I implement this one line XAML programmatically in code? (as I'm needing to create the radio buttons on the fly, but what them to having bindings) <RadioButton IsChecked="{Binding Path=Mode, Converter={StaticResource enumBooleanConverter}, ConverterParameter=Proxy}">Proxy</RadioButton> I've got it to here (see below) so ...

WPF - what's wrong with this code (trying to get IsEnabled to bind to dependency property)

Hi, Any idea where I'm going wrong with this code. I wan the TextBox to be Enabled when the associated RadioButton for it is selected, and then when a different radio button is selected want it to be Enabled=False. I created a ProxyMode dependency property and have changed the getter to obtain it's bool value based on whether Proxy i...

WPF ListView.ItemsSource Binding Problem

I have a MainViewModel and Customers property (list of CustomerViewModel objects as an ObservableCollection) inside it. I want to bind that list as a ItemsSource to ListView Control. My MainViewModel is bound to Window's DataContext property. I used ServiceLocator pattern in order to create MainViewModel instance which gets an IDataServi...

Wpf 4 DataGrid Column Binding Problem

I have created a datagrid with columns bound to an observable collection. All works well except for a column which is bound to a nullable decimal property from my business object. If I use <DataGridTextColumn Binding="{Binding Path=BaseUnitCostValue}" Header="Unit Cost Value" MinWidth="100" /> as my column definition all works well,...

Binding Background (color) for the entire row of a telerik:GridViewDataControl WPF control

I have the following class: public class ErrorMessage { public enum Severity { Error, Warning} public ErrorMessage(Severity severity, string description) { this.severity = severity; this.description = description; } public Severity severity { get; set; } public string description { get; set; } ...

How does IsSynchronizedWithCurrentItem really work with ContentControl and Data Templates?

I have a markup extension that is working with Binding. Things work well except when the markup extension is used in a DataTemplate which is then used by a ContentControl that is bound to the same property as a ListView with IsSynchronizedWithCurrentItem=true. How can I get the CurrentIt...

does WPF binding bypass the codebehind setter for dependencyproperties?

I may be doing this all wrong... so hang with me I am making a user control with a property which the user can bind to. The in setter for the property, I bind the PropertyChanged listener to the property so I can react to changes to its state. The code behind for this user control looks like this: public static readonly Depen...

Is it appropriate to thrown an exception from CoerceValueCallback

Is it appropriate to throw an exception from a CoerceValueCallback if a given value is invalid or should only ValidateValueCallback be used for DP-value-validation? ...

MVVM WPF: Reflecting a controls property to the viewmodel, when an events get triggered.

Okay i'm trying to understand WPF and the popular MVVM Pattern. Now i have this issue. I'm using a ribbon control with several tabs. In my ViewModel i have a property "ActiveTab (string)" Which should reflect the currently active tab. Since ribboncontrol doesn't have any property that shows this information i can't bind to it. So i wa...

How to display selected item / value in twoway binding combobox ?

I have one combobox which have Mode twoway binding. I binded combobox to list of family members(MemberId,MemberType) table. I want to display selected Item (MemberType) from list.. ...

bind cdata element to textbox c#

I am trying to bind a CData element to a text box, in code. the xml structure is like this: <Music> <Category> <Albums> <![CDATA[ <AlbumData> <Album> <id>A1</id> <Artist>artist 1</Artist> </Album> <Album> <id>A2</id> <Artist>artist 2</Artist> </Album> </AlbumData>...

Refresh CollectionViewSource (Entity Framework) bound control

I can't believe I can't find an answer to this... I've created Entity Framework models generated from DB (SQL Server CE) I dragged an Entity from Data Sources to my MainWindow, automagically creating this XAML: <Window.Resources> <CollectionViewSource x:Key="contentItemsViewSource" d:DesignSource="{d:DesignInstance my:ContentItem, Cre...

Button Image source binding using string.Format in WPF

With below code image is not displaying <DataTemplate x:Key="MenuButtonsTemplate"> <StackPanel Margin="5"> <TextBlock> <Button Style="{DynamicResource IconButtonStyle}" ToolTip="{Binding Path=DisplayName}" Command="{Binding Path=Command}" Height="21" Width="Auto" Foreground="White" > <Image Source="{Binding Path=Di...

Is there a way to make XAML / C# StringFormat show whole dollars for larger amounts but cents for smaller amounts?

In XAML, it is easy enough to use StringFormat='$#,0;$-#,0;Nil' to make a bound integer variable display as a nicely formatted dollar amount. e.g., 1024 would come out as '$1,024'. I have a need to deal with numbers ranging from a few cents up to a few hundred dollars - so 0.45 should display as '$0.45', but anything greater than some t...

HierarchicalDataTemplate TreeviewItem

Hi I have the following xaml: <TreeView x:Name="tvCategoryList" Grid.Column="0" Padding="0" ItemsSource="{Binding CategoriesList}"> <TreeView.ItemTemplate> <HierarchicalDataTemplate ItemsSource="{Binding Items}"> <TextBlock Text="{Binding ItemName}"/> </HierarchicalDataTemplate> </TreeView.ItemTemplate> </TreeView> ...

WPF: Nested collection binding

Hello, My application shows a question and possible answers on that question. Now I want to give the correct answer (specified in the "CorrectAnswer" property) a green color. Can someone help me? Thanks. public class Exercise { public string QuestionText { get; set; } public int CorrectAnswer { get; set; } public Answer[] A...

TemplateBinding for Dynamic Controls

I create a templated RadioButton at run time. After initializing the templated RadioButton, I set the DataContext and Tag property and then add this button in a StackPanel. The problem is that the template binding does not work. below is the XAML and the code behind. All this work if I assign values to these properties in XAML. Any ideas...

Communication between parent and child window in wpf

Hi, I have a parent window which launches a child window, after doing some selection/ operation in the child window is closed and i want to send some info back to the parent window (a custom class object) , whats the best way to accomplish this in wpf using the features provided by wpf ? Thanks in advance ! ...

Binding problem in WPF

I am new in WPF, need to bind a line to 2 dots. But the code bellow does not work: <Canvas> <Ellipse x:Name="dot1" Width="5" Height="5" Canvas.Left="50" Canvas.Top="50"/> <Ellipse x:Name="dot2" Width="5" Height="5" Canvas.Left="100" Canvas.Top="100"/> <Line X1="{Binding ElementNa...