You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
120 lines
6.0 KiB
120 lines
6.0 KiB
<UserControl x:Class="Kingo.Plugin.MapView.Views.RecentOpenProject" |
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|
mc:Ignorable="d" |
|
d:DesignHeight="450" d:DesignWidth="800"> |
|
|
|
<UserControl.Resources> |
|
<Style TargetType="DataGrid"> |
|
<!--网格线颜色--> |
|
<Setter Property="CanUserResizeColumns" Value="false"/> |
|
<Setter Property="Background" Value="White" /> |
|
<Setter Property="BorderBrush" Value="#FFF5F7F5" /> |
|
<Setter Property="HorizontalGridLinesBrush"> |
|
<Setter.Value> |
|
<SolidColorBrush Color="White"/> |
|
</Setter.Value> |
|
</Setter> |
|
<Setter Property="VerticalGridLinesBrush"> |
|
<Setter.Value> |
|
<SolidColorBrush Color="White"/> |
|
</Setter.Value> |
|
</Setter> |
|
</Style> |
|
|
|
<!--标题栏样式--> |
|
<Style TargetType="DataGridColumnHeader"> |
|
<Setter Property="SnapsToDevicePixels" Value="True" /> |
|
<Setter Property="MinWidth" Value="0" /> |
|
<Setter Property="MinHeight" Value="28" /> |
|
<Setter Property="Foreground" Value="#323433" /> |
|
<Setter Property="FontSize" Value="14" /> |
|
<Setter Property="Cursor" Value="Hand" /> |
|
<Setter Property="Template"> |
|
<Setter.Value> |
|
<ControlTemplate TargetType="DataGridColumnHeader"> |
|
<Border x:Name="BackgroundBorder" BorderThickness="0,1,0,1" |
|
BorderBrush="White" |
|
Width="Auto"> |
|
<Grid > |
|
<Grid.ColumnDefinitions> |
|
<ColumnDefinition Width="*" /> |
|
</Grid.ColumnDefinitions> |
|
<ContentPresenter Margin="0,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left"/> |
|
<Path x:Name="SortArrow" Visibility="Collapsed" Data="M0,0 L1,0 0.5,1 z" Stretch="Fill" Grid.Column="2" Width="8" Height="6" Fill="White" Margin="0,0,50,0" |
|
VerticalAlignment="Center" RenderTransformOrigin="1,1" /> |
|
<Rectangle Width="1" Fill="White" HorizontalAlignment="Right" Grid.ColumnSpan="1" /> |
|
</Grid> |
|
</Border> |
|
</ControlTemplate> |
|
</Setter.Value> |
|
</Setter> |
|
<Setter Property="Height" Value="25"/> |
|
</Style> |
|
<!--行样式触发--> |
|
<!--背景色改变必须先设置cellStyle 因为cellStyle会覆盖rowStyle样式--> |
|
<Style TargetType="DataGridRow"> |
|
<Setter Property="Background" Value="White" /> |
|
<Setter Property="Height" Value="60"/> |
|
<Setter Property="Foreground" Value="Black" /> |
|
<Style.Triggers> |
|
<Trigger Property="IsMouseOver" Value="True"> |
|
<Setter Property="Background" Value="LightGray"/> |
|
</Trigger> |
|
|
|
<Trigger Property="IsSelected" Value="True"> |
|
<Setter Property="Foreground" Value="Purple"/> |
|
</Trigger> |
|
</Style.Triggers> |
|
</Style> |
|
|
|
<!--单元格样式触发--> |
|
<Style TargetType="DataGridCell"> |
|
<Setter Property="Template"> |
|
<Setter.Value> |
|
<ControlTemplate TargetType="DataGridCell"> |
|
<TextBlock TextAlignment="Left" VerticalAlignment="Center" > |
|
<ContentPresenter /> |
|
</TextBlock> |
|
</ControlTemplate> |
|
</Setter.Value> |
|
</Setter> |
|
<Style.Triggers> |
|
<Trigger Property="IsSelected" Value="True"> |
|
<Setter Property="Foreground" Value="Black"/> |
|
</Trigger> |
|
</Style.Triggers> |
|
</Style> |
|
|
|
<Style x:Key="dgCell" TargetType="TextBlock"> |
|
<Setter Property="TextAlignment" Value="Left" /> |
|
<Setter Property="VerticalAlignment" Value="Center" /> |
|
<Setter Property="FontSize" Value="14" /> |
|
</Style> |
|
</UserControl.Resources> |
|
|
|
<Grid> |
|
<DataGrid x:Name="dgRecentOpenProject" AutoGenerateColumns="False" VerticalAlignment="Top" |
|
CanUserSortColumns="False" Margin="5" IsReadOnly="True" |
|
CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single" |
|
CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False" GridLinesVisibility="Horizontal" |
|
VerticalGridLinesBrush="{x:Null}" HorizontalGridLinesBrush="#D2D2D2" LoadingRow="DgRecentOpenProject_LoadingRow" |
|
MouseDoubleClick="DgRecentOpenProject_MouseDoubleClick" SizeChanged="DgRecentOpenProject_SizeChanged" > |
|
<DataGrid.Columns> |
|
|
|
<DataGridTemplateColumn Width="50" Header="" > |
|
<DataGridTemplateColumn.CellTemplate> |
|
<DataTemplate> |
|
<Image Margin="10,0,0,0" Width="28" Height="28" Source="{Binding FileImage}" /> |
|
</DataTemplate> |
|
</DataGridTemplateColumn.CellTemplate> |
|
</DataGridTemplateColumn> |
|
<DataGridTextColumn Header="名称" Width="*" Binding="{Binding Name}" ElementStyle="{StaticResource dgCell}"/> |
|
<DataGridTextColumn Header="" Width="50" /> |
|
<DataGridTextColumn Header="最近打开时间" Width="220" FontSize="14" Binding="{Binding RecentOpenDate}"/> |
|
</DataGrid.Columns> |
|
</DataGrid> |
|
</Grid> |
|
</UserControl>
|
|
|