优化 UI 及删除冗余代码
在 `Thickness.xaml` 中,删除多余破折号并调整 `SettingsPageHyperlinkButtonMargin` 的值。 在 `ModulePage.xaml` 中,为 `RwmodItem` 的 `Grid` 添加 `ContextFlyout`,调整高度并删除 `themes:ButtonIcon` 按钮。 删除 `CommandBarFlyout` 及其包含的所有 `AppBarButton` 元素。 在 `ModulePage.xaml.cs` 中,删除 `Button_Click` 方法及其相关逻辑。
This commit is contained in:
parent
f21ffd521a
commit
bf8190e864
|
@ -1,6 +1,4 @@
|
|||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<Thickness x:Key="LargeTopMargin">0,36,0,0</Thickness>
|
||||
<Thickness x:Key="LargeTopBottomMargin">0,36,0,36</Thickness>
|
||||
|
@ -31,6 +29,6 @@
|
|||
|
||||
<Thickness x:Key="MenuBarContentMargin">36,24,36,0</Thickness>
|
||||
|
||||
<Thickness x:Key="SettingsPageHyperlinkButtonMargin">-12,4,0,0</Thickness>
|
||||
<Thickness x:Key="SettingsPageHyperlinkButtonMargin">0,4,0,0</Thickness>
|
||||
|
||||
</ResourceDictionary>
|
||||
|
|
|
@ -14,9 +14,18 @@
|
|||
<!-- 模组 -->
|
||||
<DataTemplate x:Key="RwmodItem">
|
||||
<Grid Background="{ThemeResource SystemColorWindowColor}" CornerRadius="9">
|
||||
|
||||
<Grid.ContextFlyout>
|
||||
<MenuFlyout>
|
||||
<MenuFlyoutItem Text="解压" />
|
||||
<MenuFlyoutItem Text="删除" />
|
||||
<MenuFlyoutItem Text="重命名" />
|
||||
<MenuFlyoutItem Click="Button_OpenDir" Text="资源管理器" />
|
||||
</MenuFlyout>
|
||||
</Grid.ContextFlyout>
|
||||
<Grid
|
||||
Width="130"
|
||||
Height="160"
|
||||
Height="150"
|
||||
Padding="9,0,9,9">
|
||||
<Image
|
||||
Width="50"
|
||||
|
@ -24,11 +33,6 @@
|
|||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Source="/Assets/image/rwmod.svg" />
|
||||
<themes:ButtonIcon
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
Click="Button_Click"
|
||||
Glyph="" />
|
||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Bottom">
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
|
@ -65,7 +69,7 @@
|
|||
</Grid.ContextFlyout>
|
||||
<Grid
|
||||
Width="130"
|
||||
Height="160"
|
||||
Height="150"
|
||||
Padding="9">
|
||||
<Image
|
||||
Width="50"
|
||||
|
@ -90,20 +94,6 @@
|
|||
</DataTemplate>
|
||||
|
||||
|
||||
<CommandBarFlyout x:Name="CommandBarFlyout1" Placement="Right">
|
||||
<AppBarButton
|
||||
Icon="Share"
|
||||
Label="分享"
|
||||
ToolTipService.ToolTip="分享" />
|
||||
<AppBarButton
|
||||
Click="Button_Delete"
|
||||
Icon="Delete"
|
||||
Label="删除"
|
||||
ToolTipService.ToolTip="删除" />
|
||||
<CommandBarFlyout.SecondaryCommands>
|
||||
<AppBarButton Label="重命名" />
|
||||
</CommandBarFlyout.SecondaryCommands>
|
||||
</CommandBarFlyout>
|
||||
</Page.Resources>
|
||||
<Grid Margin="16">
|
||||
|
||||
|
|
|
@ -87,28 +87,6 @@ public sealed partial class ModulePage : Page
|
|||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 打开模组
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var button = sender as Button;
|
||||
if (button != null)
|
||||
{
|
||||
var container = VisualTreeHelper.GetParent(button) as FrameworkElement;
|
||||
if (container != null && container.DataContext is DataObject dataItem)
|
||||
{
|
||||
|
||||
FlyoutShowOptions myOption = new FlyoutShowOptions();
|
||||
myOption.ShowMode = FlyoutShowMode.Standard;
|
||||
CommandBarFlyout1.ShowAt(button, myOption);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 删除模组和文件夹
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in New Issue
Block a user