I have listview with Checkbox Items that are not HardCoded in XAML i load them during run time,
I have two scenarios
***- Listview items Hardcoded
- ListView items loaded Through Itemsource***
ListviewItems with Checkbox HardCoded
*
> Apple , Apple1 , Ball, Bottom, Mango, Fruit, Ear, Items, etc..
*
In this scenario, If i Press
A first item that starts with letter **A** will get Focus and again Pressing
A Focus set to next Item that starts with letter **A**, if it reaches the last item starts with letter **A** then again if i press
A it has to goto the first item that has starting letter **A**.
This works perfect when i do hardcode the **ListViewItem**
But Unable to Select the CheckBox Through Keyboard.
ListviewItems with Checkbox Loaded Dynamically
If i load them through **ItemsSource** within **DataTemplate** i cannot acheive the above feature andalso unable to select Checkbox using Keyboard.
Listview items to be loaded
<listview name="LV" itemssource="{Binding Responses}" borderthickness="2" tag="{Binding GUID}" removed="Khaki" margin="5">
<listview.itemtemplate>
<datatemplate>
<stackpanel x:name="Sp1" orientation="Vertical" height="Auto" datacontext="{Binding Path=.}" xmlns:x="#unknown">
<bc:checkboxextended checked="McCheckBox_Checked" margin="5" unchecked="McCheckBox_Unchecked" ischeckedreal="{Binding Path=Checked, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListViewItem}}}" fontfamily="Verdana" fontsize="12" xmlns:bc="#unknown">
<checkbox.content>
<binding path="DisplayText" />
</checkbox.content>
</bc:checkboxextended>
</stackpanel>
</datatemplate>
</listview.itemtemplate>
</listview>
CheckboxExtended Codebehind
Public Class CheckBoxExtended
Inherits CheckBox
Public Property IsCheckedReal() As System.Nullable(Of Boolean)
Get
Return CType(GetValue(IsCheckedRealProperty), System.Nullable(Of Boolean))
End Get
Set(ByVal value As System.Nullable(Of Boolean))
SetValue(IsCheckedRealProperty, value)
End Set
End Property
Public Shared ReadOnly IsCheckedRealProperty As DependencyProperty = DependencyProperty.Register("IsCheckedReal", GetType(System.Nullable(Of Boolean)), GetType(CheckBoxExtended), New FrameworkPropertyMetadata(False, FrameworkPropertyMetadataOptions.Journal Or FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, AddressOf IsCheckedRealChanged))
Public Shared Sub IsCheckedRealChanged(ByVal d As DependencyObject, ByVal e As DependencyPropertyChangedEventArgs)
m_bIsChanging = True
DirectCast(d, CheckBoxExtended).IsChecked = CBool(e.NewValue)
m_bIsChanging = False
End Sub
End Class
1. I need to travel the items by pressing the starting letter thrugh Keyboard(This is default feature of Listview,Its not working when i do it within datatemplate)
2. Need to check and Uncheck the checkboxItems