mirror of
https://gitcode.com/gh_mirrors/se/Semi.Avalonia
synced 2026-05-02 14:01:28 +08:00
Merge pull request #274 from irihitech/273-datagrid
Fix datagrid disable visual.
This commit is contained in:
@@ -13,13 +13,16 @@
|
|||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<TabControl>
|
<TabControl>
|
||||||
<TabItem Header="DataGrid">
|
<TabItem Header="DataGrid">
|
||||||
<DataGrid
|
<Grid RowDefinitions="Auto, *">
|
||||||
|
<ToggleSwitch Grid.Row="0" Content="Disable" Name="DisableToggle"></ToggleSwitch>
|
||||||
|
<DataGrid Grid.Row="1"
|
||||||
Margin="8"
|
Margin="8"
|
||||||
CanUserReorderColumns="True"
|
CanUserReorderColumns="True"
|
||||||
CanUserResizeColumns="True"
|
CanUserResizeColumns="True"
|
||||||
CanUserSortColumns="True"
|
CanUserSortColumns="True"
|
||||||
HeadersVisibility="All"
|
HeadersVisibility="All"
|
||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
|
IsEnabled="{Binding #DisableToggle.IsChecked}"
|
||||||
ItemsSource="{Binding GridData1}">
|
ItemsSource="{Binding GridData1}">
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
<DataGridTextColumn
|
<DataGridTextColumn
|
||||||
@@ -50,6 +53,8 @@
|
|||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
|
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem Header="Grouping">
|
<TabItem Header="Grouping">
|
||||||
<DataGrid
|
<DataGrid
|
||||||
@@ -162,6 +167,7 @@
|
|||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
Margin="12,0,12,12"
|
Margin="12,0,12,12"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
|
Command="{Binding AddCommand}"
|
||||||
Content="Add" />
|
Content="Add" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using System.Collections.ObjectModel;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Avalonia.Collections;
|
using Avalonia.Collections;
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
|
||||||
namespace Semi.Avalonia.Demo.ViewModels;
|
namespace Semi.Avalonia.Demo.ViewModels;
|
||||||
|
|
||||||
@@ -15,6 +16,8 @@ public class DataGridDemoViewModel: ObservableObject
|
|||||||
|
|
||||||
public ObservableCollection<SongViewModel> GridData3 { get; set; }
|
public ObservableCollection<SongViewModel> GridData3 { get; set; }
|
||||||
|
|
||||||
|
public RelayCommand AddCommand { get; set; }
|
||||||
|
|
||||||
public DataGridDemoViewModel()
|
public DataGridDemoViewModel()
|
||||||
{
|
{
|
||||||
GridData1 = new ObservableCollection<Song>(Song.Songs);
|
GridData1 = new ObservableCollection<Song>(Song.Songs);
|
||||||
@@ -28,6 +31,12 @@ public class DataGridDemoViewModel: ObservableObject
|
|||||||
CountOfComment = a.CountOfComment,
|
CountOfComment = a.CountOfComment,
|
||||||
IsSelected = false
|
IsSelected = false
|
||||||
}));
|
}));
|
||||||
|
AddCommand = new RelayCommand(Add);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Add()
|
||||||
|
{
|
||||||
|
GridData3.Add(new SongViewModel());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,5 +26,5 @@
|
|||||||
|
|
||||||
<SolidColorBrush x:Key="DataGridRowGroupHeaderCurrentBorderBrush" Opacity="0.08" Color="White" />
|
<SolidColorBrush x:Key="DataGridRowGroupHeaderCurrentBorderBrush" Opacity="0.08" Color="White" />
|
||||||
|
|
||||||
<SolidColorBrush x:Key="DataGridDisabledBackground" Color="#F9F9F9" />
|
<SolidColorBrush x:Key="DataGridDisabledBackground" Color="#E6E8EA" Opacity="0.04" />
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
@@ -26,5 +26,5 @@
|
|||||||
|
|
||||||
<SolidColorBrush x:Key="DataGridRowGroupHeaderCurrentBorderBrush" Opacity="0.08" Color="#1C1F23" />
|
<SolidColorBrush x:Key="DataGridRowGroupHeaderCurrentBorderBrush" Opacity="0.08" Color="#1C1F23" />
|
||||||
|
|
||||||
<SolidColorBrush x:Key="DataGridDisabledBackground" Color="#F9F9F9" />
|
<SolidColorBrush x:Key="DataGridDisabledBackground" Color="#2E3238" Opacity="0.02" />
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Title>Semi.Avalonia.DataGrid</Title>
|
<Title>Semi.Avalonia.DataGrid</Title>
|
||||||
<PackageReleaseNotes>Update to 11.0.1</PackageReleaseNotes>
|
<PackageReleaseNotes>Update to 11.0.1</PackageReleaseNotes>
|
||||||
|
<Version>11.0.1.1</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user