This is a migrated thread and some comments may be shown as answers.

Keyboard full row selection

3 Answers 123 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Mary
Top achievements
Rank 1
Mary asked on 24 Nov 2020, 12:30 PM

Hey

I'm trying to configure a TreeListView to select the full row of childless rows when I use the arrow keys for navigation, curiously I checked the demo and it has the behaviour I'm trying to achieve! However I have looked at the demo code and can't spot how it's achieving it, which makes me think it's the default behaviour?

When I use the arrow keys on our TreeListView, it selects the cell of childless nodes rather than the whole row, see attached gif

Many thanks

3 Answers, 1 is accepted

Sort by
0
Dilyan Traykov
Telerik team
answered on 26 Nov 2020, 11:43 AM

Hello Stewart,

Thank you for the provided image.

I tried to replicate the same behavior in a small sample project, however, the selection seems to work as desired at my end. Can you please have a look at the attached project and let me know if I'm missing something of importance?

If possible, please share the definition of your RadTreeListView control so that I can investigate a possible cause for this behavior.

Thank you in advance for your cooperation on the matter. I will be awaiting your reply.

Regards,
Dilyan Traykov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Mary
Top achievements
Rank 1
answered on 27 Nov 2020, 01:40 PM

Hey

Thanks for the reply, I've removed all the complexity from the TreeListView and the problem still occurs with the following xaml with no code behind touching it at all, we are running nuget package Telerik.UI.for.Wpf.NetCore.Xaml 2020.1.115 - I can try upgrading to the latest version if required.

Many thanks,

Stewart

<UserControl x:Class="Menu.Views.MenuTreeView"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             mc:Ignorable="d"
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
         
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
 
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
 
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition MaxWidth="80"/>
                <ColumnDefinition MaxWidth="500"/>
            </Grid.ColumnDefinitions>
        </Grid>
 
        <telerik:RadTreeListView Name="menuTree"
                                 AutoGenerateColumns="False"
                                 ItemsSource="{Binding Items}"
                                 SelectionMode="Extended">
             
            <telerik:RadTreeListView.ChildTableDefinitions>
                <telerik:TreeListViewTableDefinition ItemsSource="{Binding Items}" />
            </telerik:RadTreeListView.ChildTableDefinitions>
             
            <telerik:RadTreeListView.Columns>
                <telerik:GridViewDataColumn Header="Security Status" DataMemberBinding="{Binding Status}"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Filename}" Header="Function" />
                <telerik:GridViewDataColumn DataMemberBinding="{Binding EntryPoint}" Header="Entry Point"/>
            </telerik:RadTreeListView.Columns>
             
        </telerik:RadTreeListView>
    </Grid>
</UserControl>

 

0
Dilyan Traykov
Telerik team
answered on 30 Nov 2020, 01:53 PM

Hi Stewart,

Thank you for the provided code snippet.

Using it, I created a new sample project with the Telerik.UI.for.Wpf.NetCore.Xaml 2020.1.115 NuGet package, however, the selection still works as expected at my end. I'm attaching the project in question along with a short recording of the result I observe.

Please have a look and let me know how this differs from your stripped project.

Regards,
Dilyan Traykov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Mary
Top achievements
Rank 1
commented on 04 Nov 2021, 01:10 PM | edited

Hey,

Apologies it has taken me a long time to revisit this, I have today found out the cause, our tree list view contains items of different types. We have a common interface from which we derive into different types depending on what they represent in the tree list, I have modified your attached KeyboardSupport.zip sample to reproduce the behaviour.

See attached gif, the 3 rows that won't perform full row selection are of type 'Item2' whereas all the others are of type 'Item' - both types implement an IItem interface and derive from ViewModelBase independently. The same behaviour occurs if I change 'IItem' to an abstract class that derives from ViewModelBase solely. 

We have separate types as they perform different actions, for example one will open a website while another will start a native program. I can modify it (and probably should anyway) to use composition instead of inheritance to get around this issue.

Is this expected behaviour? 

Many thanks,

Stewart

 

 

 

 

Dilyan Traykov
Telerik team
commented on 09 Nov 2021, 08:44 AM

Hello Stewart,
Thank you for the provided recording, project, and clarification.
Indeed, in such a case, it is expected for the control to misbehave, as it requires its ItemsSource to be of homogeneous data. You can read more about this here: RadTreeListView vs RadGridView.
With this said, you can either use composition instead of inheritance as you've already mentioned, or use a hierarchical RadGridView or a RadTreeView control instead.
I hope you find any of these approaches applicable.
Tags
TreeListView
Asked by
Mary
Top achievements
Rank 1
Answers by
Dilyan Traykov
Telerik team
Mary
Top achievements
Rank 1
Share this question
or