I have a TreeView where each item has a checkbox. I want a TextBlock to be updated whenever an item is checked or unchecked in the TreeView. The TextBlock's Text should be bound to the CheckedVersions property on my DataContext so that when I read the CheckedVersions property, it gives me a string representing all the checked items in the TreeView. The checked items should be represented in a semicolon-separated string. What would be the best way to do this? I have the following XAML:
<XmlDataProvider Source="XmlData/Versions.xml" XPath="//*[count(*)=0]"
x:Key="versionsXml"
IsInitialLoadEnabled="True" IsAsynchronous="False" />
<HierarchicalDataTemplate x:Key="versionTemplate">
<CheckBox Focusable="False" IsChecked="{Binding Path=IsChecked}"
Content="{Binding Path=Name, Mode=OneTime}"/>
</HierarchicalDataTemplate>
<TreeView x:Name="trv_version"
ItemsSource="{Binding Path=Versions, Mode=OneWay}"
ItemTemplate="{StaticResource versionTemplate}" />
<TextBlock x:Name="txb_version" Text="{Binding Path=CheckedVersions}"
TextWrapping="Wrap" />
Each item in my TreeView is an instance of my VersionViewModel class, which implements INotifyPropertyChanged and notifies when the IsChecked property changes. It seems like I should be able to hook into that so that when IsChecked changes on a VersionViewModel instance in the TreeView, CheckedVersions updates. Maybe if I set UpdateSourceTrigger on the Text binding in the TextBlock? What should I set it to, though?