This commit is contained in:
末城via 2023-12-18 17:49:06 +08:00
parent 0ebd1285ae
commit 4c0d985854
3 changed files with 25 additions and 2 deletions

View File

@ -185,6 +185,8 @@
<Style x:Key="StandardPaginationStyle" TargetType="{x:Type pu:Pagination}">
<Setter Property="Height" Value="25" />
<Setter Property="ItemsWidth" Value="NaN" />
<Setter Property="ItemsPadding" Value="7,0" />
<Setter Property="ItemsBackground" Value="{DynamicResource DARKPrimaryTrans4}" />
<Setter Property="ItemsSelectedForeground" Value="{DynamicResource DARKPrimaryText}" />
<Setter Property="ItemsSelectedBackground" Value="{DynamicResource DARKPrimary}" />

View File

@ -319,8 +319,19 @@
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<pu:Pagination x:Name="pagination" Grid.Row="1" Style="{DynamicResource StandardPaginationStyle}"
CurrentPageChanged="pagination_CurrentPageChanged" />
<Grid Grid.Row="1" >
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<pu:Pagination x:Name="pagination" Style="{DynamicResource StandardPaginationStyle}"
CurrentPageChanged="pagination_CurrentPageChanged" />
<StackPanel Grid.Column="1" Margin="5,0,0,0" Orientation="Horizontal">
<TextBox x:Name="TbPage" MinWidth="50" Style="{DynamicResource StandardTextBoxStyle}"
PreviewKeyDown="TbPage_PreviewKeyDown" />
<TextBlock Margin="3,0,0,0" Text="页" VerticalAlignment="Center"/>
</StackPanel>
</Grid>
</Grid>
</Grid>
</pu:WindowX>

View File

@ -354,6 +354,7 @@ namespace VPet_Simulator.Windows
private void pagination_CurrentPageChanged(object sender, SelectedValueChangedRoutedEventArgs<int> e)
{
Search();
TbPage.Text = e.NewValue.ToString();
}
private void rMoney_Loaded(object sender, RoutedEventArgs e)
@ -408,5 +409,14 @@ namespace VPet_Simulator.Windows
((Button)sender).Content = "更好买".Translate() + mw.PrefixSave;
;
}
private void TbPage_PreviewKeyDown(object sender, KeyEventArgs e)
{
if(e.Key == Key.Enter
&& int.TryParse(TbPage.Text?.Trim(), out int page))
{
pagination.CurrentPage = Math.Min(0, Math.Max(pagination.MaxPage, page));
}
}
}
}