mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
分页
This commit is contained in:
parent
0ebd1285ae
commit
4c0d985854
@ -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}" />
|
||||
|
@ -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>
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user