VPet/VPet.Solution/Views/SettingEditor/CustomizedSettingPage.xaml

96 lines
3.9 KiB
XML

<Page
x:Class="VPet.Solution.Views.SettingEditor.CustomizedSettingPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:h="clr-namespace:HKW.WPF.Helpers"
xmlns:ll="clr-namespace:LinePutScript.Localization.WPF;assembly=LinePutScript.Localization.WPF"
xmlns:local="clr-namespace:VPet.Solution.Views.SettingEditor"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pu="https://opensource.panuon.com/wpf-ui"
xmlns:vm="clr-namespace:VPet.Solution.ViewModels.SettingEditor"
Title="CustomizedSettingsPage"
d:DataContext="{d:DesignInstance Type=vm:CustomizedSettingPageVM}"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock TextWrapping="Wrap">
<Run
FontSize="18"
FontWeight="Bold"
Text="{ll:Str 自定义链接}" /><LineBreak />
<Run Text="{ll:Str '在自定栏添加快捷方式/网页/快捷键, 可以便携启动想要的功能'}" /><LineBreak />
<Run Text="{ll:Str '键盘快捷键编写方法请参考'}" /> <Hyperlink>
<Run Text="{ll:Str '键盘快捷键 通用注解'}" />
</Hyperlink><LineBreak />
</TextBlock>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Button
x:Name="btn_DIY"
Padding="20,5,20,5"
Command="{Binding AddLinkCommand}"
Content="{ll:Str 添加新链接}"
Style="{DynamicResource Button_BaseStyle}" />
<Button
Grid.Column="1"
Padding="20,5,20,5"
d:Click="DIY_Save_Click"
Command="{Binding ClearLinksCommand}"
Content="{ll:Str 清空全部}"
Style="{DynamicResource Button_BaseStyle}" />
</Grid>
<TextBox
Grid.Row="2"
pu:TextBoxHelper.Watermark="{ll:Str 搜索名称}"
Style="{DynamicResource StandardTextBoxStyle}"
Text="{Binding SearchLink, UpdateSourceTrigger=PropertyChanged}" />
<DataGrid
Grid.Row="3"
d:ItemsSource="{d:SampleData ItemCount=10}"
AutoGenerateColumns="False"
CanUserAddRows="False"
ItemsSource="{Binding ShowLinks}"
VerticalScrollBarVisibility="Auto">
<DataGrid.RowStyle>
<Style BasedOn="{StaticResource {x:Type DataGridRow}}" TargetType="DataGridRow">
<Setter Property="Tag" Value="{Binding DataContext, RelativeSource={RelativeSource AncestorType=Page}}" />
<Setter Property="ContextMenu">
<Setter.Value>
<ContextMenu DataContext="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource Mode=Self}}">
<MenuItem
Command="{Binding PlacementTarget.Tag.RemoveLinkCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
CommandParameter="{Binding}"
Header="{ll:Str 删除}" />
</ContextMenu>
</Setter.Value>
</Setter>
</Style>
</DataGrid.RowStyle>
<DataGrid.Columns>
<DataGridTextColumn
Binding="{Binding Name, UpdateSourceTrigger=PropertyChanged}"
EditingElementStyle="{DynamicResource TextBox_LeftCenter}"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 名称}" />
<DataGridTextColumn
Binding="{Binding Link, UpdateSourceTrigger=PropertyChanged}"
EditingElementStyle="{DynamicResource TextBox_LeftCenter}"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 链接}" />
</DataGrid.Columns>
</DataGrid>
</Grid>
</Page>