UI-For-UWP icon indicating copy to clipboard operation
UI-For-UWP copied to clipboard

RadDataGrid doesn't allow row selection if removed and re-added to visual tree.

Open Going-Gone opened this issue 5 years ago • 3 comments

Description

If you target windows version 16299, this bug does not occur. If you target anything higher, then the bug occurs.

Reference to bug. Can we please look for a solution for this? https://github.com/telerik/UI-For-UWP/issues/94

Going-Gone avatar May 20 '20 13:05 Going-Gone

Hi @Going-Gone ,

The observed by you issue is not caused by the DataGrid control, but by the UWP framework itself. For some unknown reason the framework raises Unloaded event for the control while actually the control is loaded and is operational. As we are expecting the framework to raise the right events, currently we cannot apply any fix in the DataGrid control.

On your own risk you can try to remove the logic that checks whether the control is operational and thus the selection functionality should not depend on it - after that you can build a nuget by yourself and use it in your application:

protected override bool IsOperational
{
    get
    {
        return base.IsOperational && this.Owner.IsLoaded && this.suspendedCount == 0;
    }
}

replace with:

protected override bool IsOperational
{
    get
    {
        return this.suspendedCount == 0;
    }
}

Please, be aware that such a change is very risky and might result into an unexpected behavior when the control is actually unloaded.

I hope the provided information will be helpful for you.

APopatanasov avatar May 21 '20 11:05 APopatanasov

Hi @Going-Gone ,

The observed by you issue is not caused by the DataGrid control, but by the UWP framework itself. For some unknown reason the framework raises Unloaded event for the control while actually the control is loaded and is operational. As we are expecting the framework to raise the right events, currently we cannot apply any fix in the DataGrid control.

On your own risk you can try to remove the logic that checks whether the control is operational and thus the selection functionality should not depend on it - after that you can build a nuget by yourself and use it in your application:

protected override bool IsOperational
{
    get
    {
        return base.IsOperational && this.Owner.IsLoaded && this.suspendedCount == 0;
    }
}

replace with:

protected override bool IsOperational
{
    get
    {
        return this.suspendedCount == 0;
    }
}

Please, be aware that such a change is very risky and might result into an unexpected behavior when the control is actually unloaded.

I hope the provided information will be helpful for you.

When this happens. IsOperational && IsLoaded both = true, and suspendedcount = 0. What else could be causing it?

If I loop through the itemsource and select one item at a time, this problem goes away. If I use the SelectAll() the problem happens, so something with the SelectAll must be off.

Target version 18362 Min version 17134 Telerik version 1.0.1.9

Going-Gone avatar Nov 13 '20 14:11 Going-Gone

@Going-Gone It seems the observed by you issue is not the one described in #94. In #94 the selection is performed using the mouse while here you are mentioning the SelectAll method which is part of the programmatic selection of the control.

I will need a sample project that demonstrates your exact scenario and setup of the DataGrid in order to continue my investigation. Without being able to observe the issue on my side I cannot tell for sure what is causing it.

APopatanasov avatar Nov 16 '20 10:11 APopatanasov