Advertisement
Guest User

LstBox Selected Item with Checkbox Problem - WPF

a guest
Dec 16th, 2013
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 3.49 KB | None | 0 0
  1. <Controls:MetroWindow x:Class="Outlook_Add_In_Test.WPFDistroList"
  2.             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3.             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4.             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5.             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6.             mc:Ignorable="d"
  7.             xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
  8.             d:DesignHeight="410" MaxHeight="410" Title="Distribution List" MaxWidth="340" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" Width="257">
  9.  
  10.     <Controls:MetroWindow.Resources>
  11.         <ResourceDictionary>
  12.             <ResourceDictionary.MergedDictionaries>
  13.                 <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colours.xaml" />
  14.                 <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
  15.                 <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
  16.                 <ResourceDictionary Source="Theme/DeFacto.xaml" />
  17.                 <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
  18.                 <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.AnimatedTabControl.xaml" />
  19.                 <ResourceDictionary Source="Theme/FlatButton.xaml" />
  20.             </ResourceDictionary.MergedDictionaries>
  21.         </ResourceDictionary>
  22.     </Controls:MetroWindow.Resources>
  23.  
  24.     <Grid>
  25.        
  26.         <ListBox x:Name="LstDistro" ItemsSource="{Binding}" HorizontalAlignment="Left" Margin="10,10,0,42" Width="235" BorderBrush="Black" BorderThickness="2,2,1,1" SelectionMode="Multiple" SelectionChanged="LstDistro_SelectionChanged">
  27.  
  28.             <ListBox.ItemTemplate>
  29.                 <DataTemplate>
  30.                     <Grid>
  31.                         <Canvas x:Name="EventItem" HorizontalAlignment="Left" Height="42" VerticalAlignment="Top" Width="215" Background="{Binding Path=LBackground}">
  32.                             <Label Content="{Binding LInits}" HorizontalAlignment="Left" Height="33" VerticalAlignment="Top" Width="40" FontWeight="Bold" FontSize="12" Canvas.Top="5"/>
  33.                             <Label Content="{Binding LFullName}" HorizontalAlignment="Left" Height="33" VerticalAlignment="Top" Width="164" FontSize="12" Canvas.Left="40" Canvas.Top="5"/>
  34.                             <CheckBox x:Name="ChkName" IsChecked="{Binding IsSelected}" Height="20" Width="20" Canvas.Left="190" Canvas.Top="12" Checked="CheckBox_Checked" />
  35.                         </Canvas>
  36.                     </Grid>
  37.                 </DataTemplate>
  38.             </ListBox.ItemTemplate>
  39.  
  40.             <ListBox.ItemContainerStyle>
  41.                 <Style TargetType="ListBoxItem">
  42.                     <Setter Property="IsSelected" Value="{Binding IsSelected}"/>
  43.                 </Style>
  44.             </ListBox.ItemContainerStyle>
  45.            
  46.         </ListBox>
  47.        
  48.         <Controls:ProgressRing x:Name="LoadingRing" IsActive="False" Margin="95,142,96,0" VerticalAlignment="Top"/>
  49.         <Button x:Name="BtnOk" Content="Ok" HorizontalAlignment="Left" Height="36" Margin="68,340,0,0" VerticalAlignment="Top" Width="123" Background="#FF333333" Foreground="White" FontFamily="Arial" FontWeight="Normal" FontSize="14" Click="BtnOk_Click"/>
  50.     </Grid>
  51. </Controls:MetroWindow>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement