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" <Grid HorizontalAlignment="Left" VerticalAlignment="Center"
x:Name="QuickOptionsGrid" Width="400" Margin="510,0,0,0" Height="200"> x:Name="QuickOptionsGrid" Width="400" Margin="510,0,0,0" Height="200">
<StackPanel Orientation="Vertical" HorizontalAlignment="Center"> <StackPanel Orientation="Vertical" HorizontalAlignment="Center">
<!-- Tab切换区域 --> <!-- Segmented Control -->
<Grid Margin="0,0,0,20"> <Grid Margin="0,0,0,20">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> <Border Background="{DynamicResource SeewoTimerWindowButtonBackground}"
<Button x:Name="CommonTabBtn" Width="120" Height="40" Background="{DynamicResource SeewoTimerWindowButtonBackground}" CornerRadius="8"
BorderThickness="0" Click="CommonTab_Click" Cursor="Hand" Margin="0,0,15,0"> Width="240" Height="40">
<Button.Template> <Grid>
<ControlTemplate TargetType="Button"> <!-- 背景指示器 -->
<Border Background="{TemplateBinding Background}" CornerRadius="6"> <Border x:Name="SegmentedIndicator"
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/> Background="{DynamicResource SeewoTimerWindowPrimaryButtonBackground}"
</Border> CornerRadius="6"
</ControlTemplate> Width="118" Height="32"
</Button.Template> HorizontalAlignment="Left"
<TextBlock Text="常用" FontSize="16" FontWeight="Bold" VerticalAlignment="Center"
Foreground="{DynamicResource SeewoTimerWindowButtonForeground}"/> Margin="2,0,0,0"/>
</Button>
<Button x:Name="RecentTabBtn" Width="120" Height="40" Background="{DynamicResource SeewoTimerWindowButtonBackground}" <!-- 按钮容器 -->
BorderThickness="0" Click="RecentTab_Click" Cursor="Hand"> <Grid>
<Button.Template> <Button x:Name="CommonTabBtn"
<ControlTemplate TargetType="Button"> Width="120" Height="40"
<Border Background="{TemplateBinding Background}" CornerRadius="6"> Background="Transparent"
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/> BorderThickness="0"
</Border> Click="CommonTab_Click"
</ControlTemplate> Cursor="Hand"
</Button.Template> HorizontalAlignment="Left">
<TextBlock Text="最近" FontSize="16" FontWeight="Bold" <TextBlock Text="常用" FontSize="16" FontWeight="Bold"
Foreground="{DynamicResource SeewoTimerWindowButtonForeground}"/> Foreground="{DynamicResource SeewoTimerWindowButtonForeground}"/>
</Button> </Button>
</StackPanel> <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> </Grid>
<!-- 常用计时区域 --> <!-- 常用计时区域 -->
@@ -561,17 +561,36 @@ namespace Ink_Canvas
DragMove(); DragMove();
} }
// Tab切换事件处理
private void CommonTab_Click(object sender, RoutedEventArgs e) private void CommonTab_Click(object sender, RoutedEventArgs e)
{ {
CommonTimersGrid.Visibility = Visibility.Visible; CommonTimersGrid.Visibility = Visibility.Visible;
RecentTimersGrid.Visibility = Visibility.Collapsed; 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) private void RecentTab_Click(object sender, RoutedEventArgs e)
{ {
CommonTimersGrid.Visibility = Visibility.Collapsed; CommonTimersGrid.Visibility = Visibility.Collapsed;
RecentTimersGrid.Visibility = Visibility.Visible; 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);
}
} }
// 常用计时事件处理 // 常用计时事件处理