MVVM Issue

David McCallum 51 Reputation points
2024-09-15T15:31:21.6166667+00:00

I have a DataTemplate defined thus:

<DataTemplate x:Key="CopyColumnHeaderTemplate">

<StackPanel Orientation="Horizontal">

    <Label Content="{Binding}"/>

    <CheckBox VerticalContentAlignment="Center" IsChecked="{Binding CopyFilter}"/>

</StackPanel>

</DataTemplate>

and a DataGridTemplateColumn

<DataGridTemplateColumn

Width="Auto"

CellTemplate="{StaticResource ToCopyCell}"

Header="Copy"

HeaderTemplate="{StaticResource CopyColumnHeaderTemplate}" />

 

The CopyFilter binding shows no issues with my ViewModel (extending ObservableObject), but when I check the check box the following code is no executed:

    partial void OnCopyFilterChanged(bool value)

    {

        throw new Exception();

    }

      

Any ideas what I have missed?

David

XAML
XAML
A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.
814 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.