![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | Check a checkbox with the space bar Hi, i have the following XAML and can't seem to figure out how to make the checkbox react to the space bar. <ListView Height="132" Margin="35,0,20,48" Name="m_listViewEvents" VerticalAlignment="Bottom"> <ListView.ItemTemplate> <HierarchicalDataTemplate ItemsSource="{Binding Path=Items}"> <StackPanel Orientation="Horizontal"> <CheckBox IsChecked="{Binding Path=IsSelected}" Margin="1,1,4,1"/> <TextBlock Text="{Binding Path=Text}" Margin="1,1,4,1"/> </StackPanel> </HierarchicalDataTemplate> </ListView.ItemTemplate> </ListView> |
My System Specs![]() |
| | #2 (permalink) |
| | RE: Check a checkbox with the space bar Hi, Quote: > i have the following XAML and can't seem to figure out how to make the > checkbox react to the space bar. reproducible code is here: <ListBox ItemsSource="{x:Static Fonts.SystemFontFamilies}"> <ListBox.ItemTemplate> <DataTemplate> <CheckBox> <TextBlock Text="{Binding Source}"/> </CheckBox> </DataTemplate> </ListBox.ItemTemplate> </ListBox> As it turns out, a space bar does not work because key focus is not on a check box but on ListBoxItem. If I hit [TAB] to move the focus to the check box, then it works. Keyboard operation is essential for my application. Please, please help me. Thank you. |
My System Specs![]() |
| | #3 (permalink) |
| | RE: Check a checkbox with the space bar Hello, Unfortunately, this simple looking scenario is not easy to solve, it's actually pretty complicated because getting the elements defined inside a DataTemplate is changes the behaviour of the ItemsControl (it adds an idea of "checkability" to an ItemsControl which only support "selectability"). For your scenario, consider StackPanels or WrapPanels which would contain CheckBoxes for each of your items. Something like the following: <StackPanel KeyboardNavigation.DirectionalNavigation="Contained"> <CheckBox>One</CheckBox> <CheckBox>Two</CheckBox> <CheckBox>Three</CheckBox> <CheckBox>Four</CheckBox> </StackPanel> |
My System Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| how to create checkbox using vbscript | VB Script | |||
| Welcome Center - can't get rid of it (checkbox is missing!) | Vista installation & setup | |||
| Checkbox to never see this pop-up again. | Vista account administration | |||