Skip to content

Instantly share code, notes, and snippets.

/LT.xaml Secret

Created May 30, 2017 16:16
Show Gist options
  • Save anonymous/643d79faaf5b2a42138cd9fa8511e760 to your computer and use it in GitHub Desktop.
Save anonymous/643d79faaf5b2a42138cd9fa8511e760 to your computer and use it in GitHub Desktop.
<ComboBox Name="cboLetters" ItemsSource="{Binding MainLetterList, Mode=TwoWay}" VerticalAlignment="Top" SelectionChanged="cboLetters_SelectionChanged" >
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<CollectionViewSource x:Key="SelectedLetterTemplates" IsLiveSortingRequested="True" Source="{Binding Path=SelectedItem.Templates, ElementName=cboLetters, Mode=TwoWay}">
<CollectionViewSource.SortDescriptions>
<scm:SortDescription PropertyName="IsDefault" Direction="Descending"/>
<scm:SortDescription PropertyName="Description" Direction="Ascending"/>
</CollectionViewSource.SortDescriptions>
</CollectionViewSource>
<ListBox Name="lbTemplates" ItemsSource="{Binding Source={StaticResource SelectedLetterTemplates}}" Height="120" SelectionChanged="lbTemplates_SelectionChanged">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Label Visibility="{Binding IsDefault, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter=false, Mode=TwoWay}" Margin="0 0 5 0" FontWeight="Bold">(Default)</Label>
<Label Content="{Binding Description, Converter={StaticResource SingleLineTextConverter}}"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment