improve:计时器UI

This commit is contained in:
2025-10-06 17:17:56 +08:00
parent 9614536a29
commit 161b67b09d
2 changed files with 59 additions and 28 deletions
+39 -27
View File
@@ -388,34 +388,46 @@
<Grid HorizontalAlignment="Left" VerticalAlignment="Center"
x:Name="QuickOptionsGrid" Width="400" Margin="510,0,0,0" Height="200">
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
<!-- Tab切换区域 -->
<!-- Segmented Control -->
<Grid Margin="0,0,0,20">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Button x:Name="CommonTabBtn" Width="120" Height="40" Background="{DynamicResource SeewoTimerWindowButtonBackground}"
BorderThickness="0" Click="CommonTab_Click" Cursor="Hand" Margin="0,0,15,0">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}" CornerRadius="6">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Button.Template>
<TextBlock Text="常用" FontSize="16" FontWeight="Bold"
Foreground="{DynamicResource SeewoTimerWindowButtonForeground}"/>
</Button>
<Button x:Name="RecentTabBtn" Width="120" Height="40" Background="{DynamicResource SeewoTimerWindowButtonBackground}"
BorderThickness="0" Click="RecentTab_Click" Cursor="Hand">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}" CornerRadius="6">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Button.Template>
<TextBlock Text="最近" FontSize="16" FontWeight="Bold"
Foreground="{DynamicResource SeewoTimerWindowButtonForeground}"/>
</Button>
</StackPanel>
<Border Background="{DynamicResource SeewoTimerWindowButtonBackground}"
CornerRadius="8"
Width="240" Height="40">
<Grid>
<!-- 背景指示器 -->
<Border x:Name="SegmentedIndicator"
Background="{DynamicResource SeewoTimerWindowPrimaryButtonBackground}"
CornerRadius="6"
Width="118" Height="32"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Margin="2,0,0,0"/>
<!-- 按钮容器 -->
<Grid>
<Button x:Name="CommonTabBtn"
Width="120" Height="40"
Background="Transparent"
BorderThickness="0"
Click="CommonTab_Click"
Cursor="Hand"
HorizontalAlignment="Left">
<TextBlock Text="常用" FontSize="16" FontWeight="Bold"
Foreground="{DynamicResource SeewoTimerWindowButtonForeground}"/>
</Button>
<Button x:Name="RecentTabBtn"
Width="120" Height="40"
Background="Transparent"
BorderThickness="0"
Click="RecentTab_Click"
Cursor="Hand"
HorizontalAlignment="Right">
<TextBlock Text="最近" FontSize="16" FontWeight="Bold"
Foreground="{DynamicResource SeewoTimerWindowButtonForeground}"/>
</Button>
</Grid>
</Grid>
</Border>
</Grid>
<!-- 常用计时区域 -->
@@ -561,17 +561,36 @@ namespace Ink_Canvas
DragMove();
}
// Tab切换事件处理
private void CommonTab_Click(object sender, RoutedEventArgs e)
{
CommonTimersGrid.Visibility = Visibility.Visible;
RecentTimersGrid.Visibility = Visibility.Collapsed;
// 移动指示器到左侧
var indicator = this.FindName("SegmentedIndicator") as Border;
if (indicator != null)
{
var animation = new System.Windows.Media.Animation.ThicknessAnimation(
new Thickness(2, 0, 0, 0),
TimeSpan.FromMilliseconds(200));
indicator.BeginAnimation(Border.MarginProperty, animation);
}
}
private void RecentTab_Click(object sender, RoutedEventArgs e)
{
CommonTimersGrid.Visibility = Visibility.Collapsed;
RecentTimersGrid.Visibility = Visibility.Visible;
// 移动指示器到右侧
var indicator = this.FindName("SegmentedIndicator") as Border;
if (indicator != null)
{
var animation = new System.Windows.Media.Animation.ThicknessAnimation(
new Thickness(120, 0, 0, 0),
TimeSpan.FromMilliseconds(200));
indicator.BeginAnimation(Border.MarginProperty, animation);
}
}
// 常用计时事件处理