Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I work in wpf project in that i have a checkbox inside of it one listbox. i want single selection in checkbox .Please any one help. This is my code
XML
<ListBox  Name="lstbxFieldName"  HorizontalContentAlignment="Left" Height="170" Width="320"  Style="{StaticResource lstBoxStyle}" TabIndex="4">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal" Margin="20,0,0,0" ScrollViewer.VerticalScrollBarVisibility="Visible">
                        <CheckBox Name="chkuser"  Tag="{Binding FieldValue}" Content="{Binding FieldName}" HorizontalAlignment="Left" Margin="5,5,0,0"/>
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
Posted

1 solution

Simple solution is to use RadioButton.

There is no such direct method to do single selection in CheckBox. You have think of some work around. So, why wasting time. Just use RadioButton.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900