Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2815
Creating an unbounded field with button bound to ViewModel command
posted

Guys,

This is a snippet from a Style I need to modify such that the button's command property is bound to an element of IDictionary<string, ICommand> exposed by the ViewModel.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

<Setter Property

="Template">

 

 

 

<Setter.Value

>

 

 

 

<ControlTemplate TargetType="{x:Type igDP:CellValuePresenter

}">

 

 

 

<igWindows:CardPanel Width="{TemplateBinding Width}" Height="{TemplateBinding Height

}" >

 

 

 

<Button Style="{DynamicResource btnRemove}" Width="14" Height="14"

 

 

Content="{TemplateBinding Content}"

 

 

CommandParameter="{Binding ViewID

}"

 

 

Command="{Binding Commands[AcknowledgeErrorCmd]}" />

 

 

 

</igWindows:CardPanel

>

 

 

 

<ControlTemplate.Triggers

>

 

 

 

<Trigger Property="HighlightAsPrimary" Value

="True"/>

 

 

 

<Trigger Property="IsFieldSelected" Value

="True"/>

 

 

 

<Trigger Property="IsSelected" Value

="True"/>

 

 

 

<Trigger Property="IsActive" Value

="True"/>

 

 

 

<Trigger Property="IsMouseOver" Value

="True"/>

 

 

 

</ControlTemplate.Triggers

>

 

 

 

</ControlTemplate

>

 

 

 

</Setter.Value

>

 

 

 

</Setter

>

Problem is, the binding is not working.  

Now, if I replace the button with a TextBlock with the following binding:

 

 

 

<TextBlock Text="{Binding ElementName=root, Path

=DataContext.ViewID}"/>

I get DataItem.ToString() displayed, where DataItem is an instance of my data class. 

Can you please help me understand where the disconnect is from CellValuePresenter to my main view?

TIA,

Klaus

 

Parents
No Data
Reply Children
No Data