跟新颜色配置
This commit is contained in:
1 parent
45829fa267
commit
d5232c581c
7 files changed
+66
-10
No files matched your search
@@ -124,7 +124,7 @@ public partial class DataGridEx : DataGrid
|
|||||||
public bool? AreAllRowsSelected => (bool?)GetValue(AreAllRowsSelectedProperty);
|
public bool? AreAllRowsSelected => (bool?)GetValue(AreAllRowsSelectedProperty);
|
||||||
public static readonly DependencyProperty SelectedRowBackgroundProperty = DependencyProperty.Register(
|
public static readonly DependencyProperty SelectedRowBackgroundProperty = DependencyProperty.Register(
|
||||||
nameof(SelectedRowBackground), typeof(Brush), typeof(DataGridEx),
|
nameof(SelectedRowBackground), typeof(Brush), typeof(DataGridEx),
|
||||||
new PropertyMetadata((Brush)new BrushConverter().ConvertFromString("#F3EAF1")!));
|
new PropertyMetadata(Brushes.LightGray));
|
||||||
public static readonly DependencyProperty SelectedRowForegroundProperty = DependencyProperty.Register(
|
public static readonly DependencyProperty SelectedRowForegroundProperty = DependencyProperty.Register(
|
||||||
nameof(SelectedRowForeground), typeof(Brush), typeof(DataGridEx), new PropertyMetadata(Brushes.Black));
|
nameof(SelectedRowForeground), typeof(Brush), typeof(DataGridEx), new PropertyMetadata(Brushes.Black));
|
||||||
public static readonly DependencyProperty ShowCheckBoxProperty = DependencyProperty.Register(
|
public static readonly DependencyProperty ShowCheckBoxProperty = DependencyProperty.Register(
|
||||||
|
|||||||
@@ -1006,7 +1006,7 @@
|
|||||||
<Setter Property="HorizontalContentAlignment" Value="Right" />
|
<Setter Property="HorizontalContentAlignment" Value="Right" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style BasedOn="{StaticResource DataGridExDefaultDataGridStyle}" TargetType="local:DataGridEx">
|
<Style x:Key="DataGridExBaseStyle" BasedOn="{StaticResource DataGridExDefaultDataGridStyle}" TargetType="local:DataGridEx">
|
||||||
<Setter Property="EnableRowVirtualization" Value="True" />
|
<Setter Property="EnableRowVirtualization" Value="True" />
|
||||||
<Setter Property="EnableColumnVirtualization" Value="True" />
|
<Setter Property="EnableColumnVirtualization" Value="True" />
|
||||||
<Setter Property="VirtualizingPanel.IsVirtualizing" Value="True" />
|
<Setter Property="VirtualizingPanel.IsVirtualizing" Value="True" />
|
||||||
@@ -1020,4 +1020,5 @@
|
|||||||
<Setter Property="RowHeaderStyle" Value="{StaticResource DataGridExRowHeaderStyle}" />
|
<Setter Property="RowHeaderStyle" Value="{StaticResource DataGridExRowHeaderStyle}" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
<Style BasedOn="{StaticResource DataGridExBaseStyle}" TargetType="local:DataGridEx" />
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
@@ -43,8 +43,8 @@
|
|||||||
<Color x:Key="DarkMaskColor">#20000000</Color>
|
<Color x:Key="DarkMaskColor">#20000000</Color>
|
||||||
<Color x:Key="DarkOpacityColor">#40000000</Color>
|
<Color x:Key="DarkOpacityColor">#40000000</Color>
|
||||||
|
|
||||||
<SolidColorBrush x:Key="TreeViewItemSelectedBrush" Color="#F3EAF1" />
|
<SolidColorBrush x:Key="SelectedBackgroundBrush" Color="#F3EAF1" />
|
||||||
<SolidColorBrush x:Key="TreeViewItemSelectedBrush2" Color="#784B70" />
|
<SolidColorBrush x:Key="SelectedForegroundBrush" Color="#784B70" />
|
||||||
|
|
||||||
<Color x:Key="BackgrondColor1">#F7F8F9</Color>
|
<Color x:Key="BackgrondColor1">#F7F8F9</Color>
|
||||||
<Color x:Key="BackgrondColor2">#F0F2F4</Color>
|
<Color x:Key="BackgrondColor2">#F0F2F4</Color>
|
||||||
|
|||||||
@@ -12,9 +12,13 @@
|
|||||||
<ResourceDictionary Source="pack://application:,,,/MAX.Common.WPF;component/Resources/Generic.xaml" />
|
<ResourceDictionary Source="pack://application:,,,/MAX.Common.WPF;component/Resources/Generic.xaml" />
|
||||||
<ResourceDictionary Source="/Store.Management.Framework;component/Controls/DataGridEx/DataGridEx.xaml" />
|
<ResourceDictionary Source="/Store.Management.Framework;component/Controls/DataGridEx/DataGridEx.xaml" />
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
|
||||||
<FontFamily x:Key="IconPack">Fonts/iconfont.ttf#iconfont</FontFamily>
|
<FontFamily x:Key="IconPack">Fonts/iconfont.ttf#iconfont</FontFamily>
|
||||||
|
|
||||||
|
<Style BasedOn="{StaticResource DataGridExBaseStyle}" TargetType="{x:Type f:DataGridEx}">
|
||||||
|
<Setter Property="SelectedRowBackground" Value="{DynamicResource SelectedBackgroundBrush}" />
|
||||||
|
<Setter Property="SelectedRowForeground" Value="{DynamicResource SelectedForegroundBrush}" />
|
||||||
|
</Style>
|
||||||
<Style x:Key="TextBlockIcon" TargetType="{x:Type TextBlock}">
|
<Style x:Key="TextBlockIcon" TargetType="{x:Type TextBlock}">
|
||||||
<Setter Property="FontFamily" Value="{StaticResource IconPack}" />
|
<Setter Property="FontFamily" Value="{StaticResource IconPack}" />
|
||||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||||
@@ -23,6 +27,14 @@
|
|||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style BasedOn="{StaticResource TextBlockIcon}" TargetType="{x:Type f:IconText}" />
|
<Style BasedOn="{StaticResource TextBlockIcon}" TargetType="{x:Type f:IconText}" />
|
||||||
|
<Style BasedOn="{StaticResource {x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
|
||||||
|
<Setter Property="Width" Value="200" />
|
||||||
|
<Style.Resources>
|
||||||
|
<Style BasedOn="{StaticResource TextBlockIcon}" TargetType="{x:Type f:IconText}">
|
||||||
|
<Setter Property="FontSize" Value="16" />
|
||||||
|
</Style>
|
||||||
|
</Style.Resources>
|
||||||
|
</Style>
|
||||||
<Style
|
<Style
|
||||||
x:Key="WindowBase"
|
x:Key="WindowBase"
|
||||||
BasedOn="{StaticResource WindowWin10}"
|
BasedOn="{StaticResource WindowWin10}"
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
Style="{StaticResource NavItemButton}">
|
Style="{StaticResource NavItemButton}">
|
||||||
<Button.Content>
|
<Button.Content>
|
||||||
<Border
|
<Border
|
||||||
|
x:Name="NavItemBackground"
|
||||||
Height="45"
|
Height="45"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
BorderBrush="{StaticResource SecondaryBorderBrush}"
|
BorderBrush="{StaticResource SecondaryBorderBrush}"
|
||||||
@@ -65,6 +66,11 @@
|
|||||||
</Button.Content>
|
</Button.Content>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
|
<DataTemplate.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding IsSelected, Mode=OneWay}" Value="True">
|
||||||
|
<Setter TargetName="NavItemBackground" Property="Background" Value="{StaticResource SelectedBackgroundBrush}" />
|
||||||
|
</DataTrigger>
|
||||||
|
</DataTemplate.Triggers>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
<ItemsControl
|
<ItemsControl
|
||||||
|
|||||||
@@ -20,11 +20,27 @@
|
|||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<wpf:BindingProxy x:Key="PageViewModel" Data="{Binding Mode=OneWay}" />
|
<wpf:BindingProxy x:Key="PageViewModel" Data="{Binding Mode=OneWay}" />
|
||||||
<ContextMenu x:Key="UserRowMenu" DataContext="{Binding Data, Source={StaticResource PageViewModel}, Mode=OneWay}">
|
<ContextMenu x:Key="UserRowMenu" DataContext="{Binding Data, Source={StaticResource PageViewModel}, Mode=OneWay}">
|
||||||
<MenuItem Command="{Binding EditCommand}" Header="编辑" />
|
<MenuItem Command="{Binding EditCommand}" Header="编辑">
|
||||||
<MenuItem Command="{Binding BillingCommand}" Header="计费配置" />
|
<MenuItem.Icon>
|
||||||
<MenuItem Command="{Binding DeleteCommand}" Header="删除" />
|
<f:IconText Icon="Edit" />
|
||||||
|
</MenuItem.Icon>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem Command="{Binding BillingCommand}" Header="计费配置">
|
||||||
|
<MenuItem.Icon>
|
||||||
|
<f:IconText Icon="Calculator" />
|
||||||
|
</MenuItem.Icon>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem Command="{Binding DeleteCommand}" Header="删除">
|
||||||
|
<MenuItem.Icon>
|
||||||
|
<f:IconText Icon="Delete" />
|
||||||
|
</MenuItem.Icon>
|
||||||
|
</MenuItem>
|
||||||
<Separator />
|
<Separator />
|
||||||
<MenuItem Command="{Binding CreateCommand}" Header="创建用户" />
|
<MenuItem Command="{Binding CreateCommand}" Header="创建用户">
|
||||||
|
<MenuItem.Icon>
|
||||||
|
<f:IconText Icon="PersonAdd" />
|
||||||
|
</MenuItem.Icon>
|
||||||
|
</MenuItem>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
|
|
||||||
|
|||||||
@@ -61,8 +61,29 @@ class Program
|
|||||||
Console.WriteLine("PASS: LoginViewModel -> ILoginService -> AuthApi, retry, password contract and cancellation.");
|
Console.WriteLine("PASS: LoginViewModel -> ILoginService -> AuthApi, retry, password contract and cancellation.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
App app = args.Contains("--status-bar") || args.Contains("--view-lifecycle") ? new App() : new TestApp(client);
|
App app = args.Contains("--status-bar") || args.Contains("--view-lifecycle") || args.Contains("--grid-style") ? new App() : new TestApp(client);
|
||||||
app.InitializeComponent();
|
app.InitializeComponent();
|
||||||
|
if (args.Contains("--grid-style"))
|
||||||
|
{
|
||||||
|
app.ShutdownMode = ShutdownMode.OnExplicitShutdown;
|
||||||
|
var grid = new DataGridEx { ItemsSource = new[] { new { Name = "测试用户" } } };
|
||||||
|
grid.Columns.Add(new DataGridTextColumn { Header = "名称", Binding = new System.Windows.Data.Binding("Name") });
|
||||||
|
var window = new Window { Content = grid, Width = 500, Height = 300, ShowInTaskbar = false };
|
||||||
|
try
|
||||||
|
{
|
||||||
|
window.Show();
|
||||||
|
grid.UpdateLayout();
|
||||||
|
Check(grid.Template != null, "表格模板必须保留");
|
||||||
|
Check(grid.ItemContainerGenerator.ContainerFromIndex(0) is DataGridRow, "数据行必须生成");
|
||||||
|
grid.SelectedIndex = 0;
|
||||||
|
grid.UpdateLayout();
|
||||||
|
Check(ReferenceEquals(grid.SelectedRowBackground, app.FindResource("SelectedBackgroundBrush")), "主题选中背景");
|
||||||
|
Check(ReferenceEquals(grid.SelectedRowForeground, app.FindResource("SelectedForegroundBrush")), "主题选中文字");
|
||||||
|
Console.WriteLine("PASS: DataGridEx theme retains template, data rows and selection colors.");
|
||||||
|
}
|
||||||
|
finally { window.Close(); app.Shutdown(); }
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
if (args.Contains("--view-lifecycle"))
|
if (args.Contains("--view-lifecycle"))
|
||||||
{
|
{
|
||||||
app.ShutdownMode = ShutdownMode.OnExplicitShutdown;
|
app.ShutdownMode = ShutdownMode.OnExplicitShutdown;
|
||||||
|
|||||||
Reference in new issue
Block a user