I am binding my radtreeview to a collectionviewsource that is grouped on the employee's last name initial (A, B, C, etc.). I also bind the selecteditem to a property on my viewmodel which is of type Employee. The problem is that when I select the parent node (A, B, C, etc.) it fails validation and gives me a red border. I want to override that and disable it.
Private
_selectedItem
As
Library.EmployeeInfo
Public
Property
SelectedItem
As
Library.EmployeeInfo
Get
Return
_selectedItem
End
Get
Set
(
ByVal
value
As
Library.EmployeeInfo)
If
IsBusy
Then
Return
_selectedItem = value
NotifyOfPropertyChange(
Function
() SelectedItem)
Events.Publish(
New
SelectionChangedEvent(Of EmployeeListViewModel, Library.EmployeeInfo)
With
{.Source =
Me
, .Obj =
Me
.SelectedItem})
End
Set
End
Property
<
Grid.Resources
>
<
bengenconv:SingleCharacterConverter
x:Key
=
"SingleCharacterConverter"
/>
<
CollectionViewSource
x:Key
=
"Emps"
Source
=
"{Binding Model}"
>
<
CollectionViewSource.SortDescriptions
>
<
componentModel:SortDescription
PropertyName
=
"Lastname"
/>
<
componentModel:SortDescription
PropertyName
=
"Firstname"
/>
<
componentModel:SortDescription
PropertyName
=
"EmployeeIdNumber"
/>
</
CollectionViewSource.SortDescriptions
>
<
CollectionViewSource.GroupDescriptions
>
<
PropertyGroupDescription
PropertyName
=
"Lastname"
Converter
=
"{StaticResource SingleCharacterConverter}"
/>
</
CollectionViewSource.GroupDescriptions
>
</
CollectionViewSource
>
<
DataTemplate
x:Key
=
"EmployeeTemplate"
>
<
TextBlock
>
<
TextBlock.Text
>
<
MultiBinding
StringFormat
=
"{}{0}, {1}"
>
<
Binding
Path
=
"Lastname"
/>
<
Binding
Path
=
"Firstname"
/>
</
MultiBinding
>
</
TextBlock.Text
></
TextBlock
>
</
DataTemplate
>
<
HierarchicalDataTemplate
x:Key
=
"GroupsTemplate"
ItemsSource
=
"{Binding Items}"
ItemTemplate
=
"{StaticResource EmployeeTemplate}"
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
TextBlock
Text
=
"{Binding Name}"
/>
<
TextBlock
Text
=
"{Binding ItemCount, StringFormat=' ({0})'}"
FontSize
=
"11"
FontStyle
=
"Italic"
Foreground
=
"DimGray"
VerticalAlignment
=
"Center"
/>
</
StackPanel
>
</
HierarchicalDataTemplate
>
</
Grid.Resources
>
<
telerik:RadTreeView
x:Name
=
"xTreeView"
ItemsSource
=
"{Binding Source={StaticResource Emps}, Path=Groups}"
Grid.Row
=
"1"
Padding
=
"5"
BorderThickness
=
"0"
IsEditable
=
"False"
SelectionMode
=
"Single"
SelectedItem
=
"{Binding SelectedItem, Mode=TwoWay}"
ItemTemplate
=
"{StaticResource GroupsTemplate}"
IsSingleExpandPath
=
"True"
IsExpandOnSingleClickEnabled
=
"True"
>
</
telerik:RadTreeView
>
</
Grid
>