How to Select Multi Items in Hierarchy?

2 Answers 20 Views
GridView
Psyduck
Top achievements
Rank 5
Bronze
Bronze
Bronze
Psyduck asked on 22 Feb 2022, 02:58 AM | edited on 22 Feb 2022, 03:00 AM

Hello.

An example of Select Single Item in Hierarchy in GridView is in SDK.

I changed the xaml property 'SelectionMode' but it didn't work.

How do I solve this?

And is it possible to change it with mvvm? I have to use other views as well.

Thanks.

2 Answers, 1 is accepted

Sort by
1
Accepted
Stenly
Telerik team
answered on 24 Feb 2022, 09:25 AM

Hello Psyduck,

The parent RadGridView control instance, inside the specified SDK example, has a custom implementation of the SelectionChanged event, which could prevent multiple row selection when the SelectionMode is set to Multiple. You could unsubscribe the parent grid vie element from the SelectionChanged event, and it would allow you to select multiple rows. 

Regarding the control through the view model, you could create a new property, which is of type SelectionMode, and bind it to the SelectionMode property of the parent RadGridView control. The following code snippets show this logic's implementation:

public class MyViewModel : INotifyPropertyChanged
{
    private SelectionMode currentSelectionMode;

    public MyViewModel()
    {
        this.CurrentSelectionMode = SelectionMode.Multiple;
    }

    public SelectionMode CurrentSelectionMode
    {
        get { return currentSelectionMode; }
	set { currentSelectionMode = value; OnPropertyChanged(nameof(this.CurrentSelectionMode)); }
    }	
}
<telerik:RadGridView SelectionMode="{Binding CurrentSelectionMode}" />

With that said, could you give this suggestion a try and let me know how it goes?

Regards,
Stenly
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

0
Psyduck
Top achievements
Rank 5
Bronze
Bronze
Bronze
answered on 02 Mar 2022, 09:31 AM

Hello.

My purpose is to want multiple selection of child gridview while including the SDK function.

That is, multi-selection in child gridview. When another child gridview is multi-selected, the selection is deselected in the first child gridview.

What Stenly told me seems to be simply setting the gridview's selectionmode.
Also, something is strange even with the example above. It's not the direction I want it to go.

Thanks.

 

 

Stenly
Telerik team
commented on 07 Mar 2022, 08:02 AM

I have modified the sample project from the SDK example, so, could you give it a try and let me know whether this would work for you? If this is not the desired result, would it be a problem to share a bit more information regarding it?
Psyduck
Top achievements
Rank 5
Bronze
Bronze
Bronze
commented on 14 Mar 2022, 11:04 AM

I set the EnableLostFocusSelectedState property in my source and I overlooked it.

For your reference, the project you sent me could not be debugged, so I made a new project and tested it.

thank you.
Stenly
Telerik team
commented on 17 Mar 2022, 08:47 AM

May I ask if the EnableLostFocusSelectedState property was the reason for the reported behavior, as I am not sure that I fully understand the latest reply?
Psyduck
Top achievements
Rank 5
Bronze
Bronze
Bronze
commented on 17 Mar 2022, 09:09 AM

I set the EnableLostFocusSelectedState property to false and used it as above and determined that it didn't work. Clearing that property works fine. b
Tags
GridView
Asked by
Psyduck
Top achievements
Rank 5
Bronze
Bronze
Bronze
Answers by
Stenly
Telerik team
Psyduck
Top achievements
Rank 5
Bronze
Bronze
Bronze
Share this question
or