How to disable radtreeview validation

2 posts, 0 answers
  1. cman
    cman avatar
    3 posts
    Member since:
    Jul 2011

    Posted 22 Jan 2013 Link to this post

    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
            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

            <bengenconv:SingleCharacterConverter x:Key="SingleCharacterConverter" />
            <CollectionViewSource x:Key="Emps"
                                  Source="{Binding Model}">
                    <componentModel:SortDescription PropertyName="Lastname" />
                    <componentModel:SortDescription PropertyName="Firstname" />
                    <componentModel:SortDescription PropertyName="EmployeeIdNumber" />
                    <PropertyGroupDescription PropertyName="Lastname"
                                              Converter="{StaticResource SingleCharacterConverter}" />
            <DataTemplate x:Key="EmployeeTemplate">
                        <MultiBinding StringFormat="{}{0}, {1}">
                            <Binding Path="Lastname" />
                            <Binding Path="Firstname" />
            <HierarchicalDataTemplate x:Key="GroupsTemplate"
                                      ItemsSource="{Binding Items}"
                                      ItemTemplate="{StaticResource EmployeeTemplate}">
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="{Binding Name}"/>
                    <TextBlock Text="{Binding ItemCount, StringFormat='  ({0})'}"
        <telerik:RadTreeView x:Name="xTreeView"
                             ItemsSource="{Binding Source={StaticResource Emps}, Path=Groups}"
                             SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
                             ItemTemplate="{StaticResource GroupsTemplate}"
  2. cman
    cman avatar
    3 posts
    Member since:
    Jul 2011

    Posted 22 Jan 2013 Link to this post

    As seems typical after posting, I found an answer that disables the validation on that control.  I still wonder if there's a better way to accomplish the same thing without disabling validation.  But here's what I found in case someone else needs it.
    <telerik:RadTreeView x:Name="xTreeView" ... >
            <ControlTemplate />
Back to Top