mirror of
https://github.com/ZuneDev/ZuneModdingHelper.git
synced 2026-07-27 13:12:21 -07:00
Implement pivot selection
This commit is contained in:
@@ -22,6 +22,11 @@
|
||||
<Setter Property="Width" Value="32"/>
|
||||
<Setter Property="Padding" Value="12"/>
|
||||
</Style>
|
||||
<Style x:Key="PivotButtonStyle" TargetType="zmhc:TextButton" BasedOn="{StaticResource DefaultTextButtonStyle}">
|
||||
<Setter Property="FontFamily" Value="segoe zuc"/>
|
||||
<Setter Property="FontSize" Value="12"/>
|
||||
<Setter Property="AllowUncheck" Value="False"/>
|
||||
</Style>
|
||||
</Window.Resources>
|
||||
|
||||
<Border>
|
||||
@@ -61,10 +66,13 @@
|
||||
<TextBlock Text="{x:Static zmh:App.Title}" Grid.RowSpan="2"
|
||||
Foreground="#3B3F42" FontSize="28" FontFamily="segoe zlc" Margin="0,-6,0,0" />
|
||||
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="1" VerticalAlignment="Bottom">
|
||||
<zmhc:TextButton Text="Mods" FontFamily="segoe zuc" FontSize="12" AllowUncheck="False"/>
|
||||
<zmhc:TextButton Text="Settings" FontFamily="segoe zuc" FontSize="12" Margin="6,0,0,0"/>
|
||||
<zmhc:TextButton Text="About" FontFamily="segoe zuc" FontSize="12" Margin="6,0,0,0"/>
|
||||
<StackPanel x:Name="Pivot" Grid.Row="1" VerticalAlignment="Bottom" Orientation="Horizontal">
|
||||
<zmhc:TextButton Text="Mods" Grid.Column="0" Width="36"
|
||||
Checked="PivotButton_Checked" Style="{StaticResource PivotButtonStyle}" />
|
||||
<zmhc:TextButton Text="Settings" Grid.Column="1" Width="58" Margin="6,0,0,0"
|
||||
Checked="PivotButton_Checked" Style="{StaticResource PivotButtonStyle}" />
|
||||
<zmhc:TextButton Text="About" Grid.Column="2" Margin="6,0,0,0"
|
||||
Checked="PivotButton_Checked" Style="{StaticResource PivotButtonStyle}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Interop;
|
||||
|
||||
namespace ZuneModdingHelper
|
||||
@@ -10,12 +12,21 @@ namespace ZuneModdingHelper
|
||||
public partial class AppWindow
|
||||
{
|
||||
private IntPtr _windowHandle;
|
||||
private int _selectedPivotIdx = 0;
|
||||
|
||||
public AppWindow()
|
||||
{
|
||||
Loaded += AppWindow_Loaded;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void AppWindow_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// Select MODS tab
|
||||
var pivotItem = (ToggleButton)Pivot.Children[_selectedPivotIdx];
|
||||
pivotItem.IsChecked = true;
|
||||
}
|
||||
|
||||
protected override void OnSourceInitialized(EventArgs e)
|
||||
{
|
||||
base.OnSourceInitialized(e);
|
||||
@@ -41,5 +52,19 @@ namespace ZuneModdingHelper
|
||||
WindowState = state;
|
||||
WindowStyle = WindowStyle.None;
|
||||
}
|
||||
|
||||
private void PivotButton_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var newIdx = Grid.GetColumn((UIElement)sender);
|
||||
if (newIdx == _selectedPivotIdx)
|
||||
return;
|
||||
|
||||
var pivotItem = (ToggleButton)Pivot.Children[_selectedPivotIdx];
|
||||
pivotItem.IsChecked = false;
|
||||
|
||||
_selectedPivotIdx = newIdx;
|
||||
pivotItem = (ToggleButton)Pivot.Children[_selectedPivotIdx];
|
||||
pivotItem.IsChecked = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user