WpfMdict / csharp /mdict /Views /LibraryView.xaml
fasdfsa's picture
添加词典功能
e3ea2f2
<UserControl x:Class="mdict.Views.LibraryView"
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">
<Grid Background="#F0F2F5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Border Background="White" Padding="20" BorderBrush="#E0E0E0" BorderThickness="0,0,0,1">
<DockPanel>
<TextBlock Text="Library" FontSize="24" FontWeight="Bold" VerticalAlignment="Center" Foreground="#333"/>
<Button Content="Add Dictionary" Click="AddDictionary_Click" HorizontalAlignment="Right" Padding="15,8" Background="#007AFF" Foreground="White" BorderThickness="0">
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="6"/>
</Style>
</Button.Resources>
</Button>
</DockPanel>
</Border>
<ListView x:Name="DictionariesList" Grid.Row="1" Margin="20" BorderThickness="0" Background="Transparent">
<ListView.ItemTemplate>
<DataTemplate>
<Border Background="White" Padding="15" Margin="0,0,0,10" CornerRadius="8">
<Border.Effect>
<DropShadowEffect Color="Black" Opacity="0.05" BlurRadius="10" ShadowDepth="2"/>
</Border.Effect>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="📖" FontSize="24" VerticalAlignment="Center" Margin="0,0,15,0"/>
<StackPanel Grid.Column="1" VerticalAlignment="Center">
<TextBlock Text="{Binding Name}" FontSize="16" FontWeight="SemiBold" Foreground="#333"/>
<TextBlock Text="{Binding FilePath}" FontSize="12" Foreground="#999" Margin="0,4,0,0"/>
</StackPanel>
<Button Grid.Column="2" Content="Remove" Click="RemoveDictionary_Click" Tag="{Binding}" Padding="10,5" Background="#FF3B30" Foreground="White" BorderThickness="0" VerticalAlignment="Center">
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="4"/>
</Style>
</Button.Resources>
</Button>
</Grid>
</Border>
</DataTemplate>
</ListView.ItemTemplate>
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListViewItem">
<ContentPresenter/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListView.ItemContainerStyle>
</ListView>
</Grid>
</UserControl>