samedi 25 avril 2015

handle check event on checkbox in wpf

i have a listview containing name and two chechbox( name, male(checkbox),female(checkbox)). i want make sure only one checkbox is selected from listview at a time.

   <UserControl.Resources>
   <DataTemplate x:Key="datatemp">
        <StackPanel Orientation="Horizontal" Width="200" >
            <TextBlock Text="{Binding VmName}" Width="129" Visibility="Visible" />
            <CheckBox  Name="cb"  IsThreeState="False" Checked="off_chek_select"  IsChecked="{Binding IsCheck, Mode=TwoWay}"  Margin="6,0,18,6" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
            <CheckBox  Name="cb1" IsThreeState="False" Checked="ins_chek_select" IsChecked="{Binding IsCheck1, Mode=TwoWay}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"  />
        </StackPanel>
    </DataTemplate>
</UserControl.Resources>

here i have used this datatemplate in listview. i am not able to access controls from datatemplate for writing on check event.




Aucun commentaire:

Enregistrer un commentaire