telerik / UI-For-UWP

This repo contains the source code for Telerik UI for Universal Windows Platform (UWP), which includes 20+ UI controls for developers building UWP applications.
http://www.telerik.com/uwp/
Other
1.16k stars 234 forks source link

[Bug] RadDataGrid columns can not reorder normally after toggle IsVisible Property to hide/show the columns #510

Open SonHai32 opened 2 years ago

SonHai32 commented 2 years ago

Description

Binding the IsVisible Property from ViewModel into DataGridTextColumn to hide/show column by toggling the checkbox All the checkbox binding the boolean property in mode TwoWay

Steps to Reproduce

  1. Create UWP Project and import some Nuget Packages as same as Basic Infomation bellow
  2. Create the ViewModel with inheritance of ViewModelBase (using GalaSoft.MvvmLight). Define 3 properties _one; _two; _three; with type of bool and have default value = true. We can see this code bellow:
    
    using GalaSoft.MvvmLight;

namespace Test { public class TestVM : ViewModelBase { private bool _one = true; private bool _two = true; private bool _three = true; public bool One { get => _one; set => Set(ref _one, value); }

    public bool Two
    {
        get => _two;
        set => Set(ref _two, value);
    }
    public bool Three
    {
        get => _three;
        set => Set(ref _three, value);
    }
}

}

4. Create the MainPage.xaml with using RadDataGrid like this code bellow:

<Page x:Class="Test.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:Test" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" xmlns:tg="using:Telerik.UI.Xaml.Controls.Grid" xmlns:gridPrimitives="using:Telerik.UI.Xaml.Controls.Grid.Primitives" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

- Three DataGridTextColumns (column with Header=1, 2 and 3) has the Property **IsVisible** with binding mode **OneWay** to **ViewModel**
- Three Checkboxs has the Property "IsChecked" with binding mode **TwoWay** to toggle the Property from ViewModel. Three checkbox use to hide/show 3 columns in DataGrid
5. Run the Project
6. Try to swap some columns, and it work normally
7. Hide 3 columns **1;2;3**
8. Swap column **4;5**
9. Show column **3**
10. Swap column **3** and see how it working 

### Expected Behavior
The column **3** can swap normally

### Actual Behavior
The column **3** can not swap with other columns

### See this gif bellow for more details: 
![ezgif com-video-to-gif](https://user-images.githubusercontent.com/48214325/164586239-a886e960-154d-4854-a06c-d0dadcae7932.gif)

### Basic Information
- Version with issue: 1.0.2.8
- IDE: Visual Studio Community 2019
- UWP SDK: 10.0.19041.0
- Nuget Packages:
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
  <Version>6.2.12</Version>
</PackageReference>
<PackageReference Include="Microsoft.Toolkit.Uwp.UI.Controls">
  <Version>5.1.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.Toolkit.Uwp.UI.Controls.DataGrid">
  <Version>5.1.0</Version>
</PackageReference>
<PackageReference Include="MvvmLight">
  <Version>5.4.1.1</Version>
</PackageReference>
<PackageReference Include="Telerik.UI.for.UniversalWindowsPlatform">
  <Version>1.0.2.8</Version>
</PackageReference>
<PackageReference Include="WinUX.UWP.Xaml.Controls">
  <Version>2.4.17005.1</Version>
</PackageReference>