Skip to content

Commit

Permalink
[Mouse Jump] - fixing mouse jump settings ui - microsoft#25482
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeclayton committed Aug 5, 2024
1 parent 7bbf1b2 commit 4782f1b
Show file tree
Hide file tree
Showing 2 changed files with 133 additions and 121 deletions.
236 changes: 117 additions & 119 deletions src/settings-ui/Settings.UI/SettingsXAML/Panels/MouseJumpPanel.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,127 +126,125 @@
IsEnabled="{x:Bind ViewModel.IsMouseJumpEnabled, Mode=OneWay}"
IsExpanded="False">
<tkcontrols:SettingsExpander.Items>
<Image Source="{x:Bind Path=ViewModel.MouseJumpPreviewImage, Mode=OneWay}" />
<StackPanel>
<tkcontrols:SettingsCard x:Uid="MouseUtils_MouseJump_PreviewType">
<StackPanel Orientation="Horizontal">
<tkcontrols:Segmented
x:Name="PreviewTypeSetting"
SelectedIndex="{x:Bind ViewModel.MouseJumpPreviewType, Mode=TwoWay, Converter={StaticResource MouseJumpPreviewTypeConverter}}"
SelectionChanged="PreviewTypeSetting_SelectionChanged"
SelectionMode="Single"
Style="{StaticResource ButtonSegmentedStyle}">
<tkcontrols:SegmentedItem>Compact</tkcontrols:SegmentedItem>
<tkcontrols:SegmentedItem>Bezelled</tkcontrols:SegmentedItem>
<tkcontrols:SegmentedItem>Custom</tkcontrols:SegmentedItem>
</tkcontrols:Segmented>
<Button
x:Name="CopyStyleToCustom"
Margin="20,0,0,0"
Click="CopyStyleToCustom_Click"
Content="Copy to Custom preview style"
IsEnabled="{Binding SelectedIndex, ElementName=MouseUtils_MouseJump_PreviewType}" />
</StackPanel>
</tkcontrols:SettingsCard>
<StackPanel x:Name="CustomStyleSettings">
<tkcontrols:SettingsCard x:Uid="MouseUtils_MouseJump_BackgroundColor1">
<controls:ColorPickerButton SelectedColor="{x:Bind Path=ViewModel.MouseJumpBackgroundColor1, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard x:Uid="MouseUtils_MouseJump_BackgroundColor2">
<controls:ColorPickerButton SelectedColor="{x:Bind Path=ViewModel.MouseJumpBackgroundColor2, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard x:Uid="MouseUtils_MouseJump_BorderThickness">
<NumberBox
MinWidth="{StaticResource SettingActionControlMinWidth}"
LargeChange="1"
Maximum="25"
Minimum="0"
SmallChange="1"
SpinButtonPlacementMode="Compact"
Value="{x:Bind ViewModel.MouseJumpBorderThickness, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard x:Uid="MouseUtils_MouseJump_BorderColor">
<controls:ColorPickerButton SelectedColor="{x:Bind Path=ViewModel.MouseJumpBorderColor, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard x:Uid="MouseUtils_MouseJump_Border3dDepth">
<NumberBox
MinWidth="{StaticResource SettingActionControlMinWidth}"
LargeChange="1"
Maximum="25"
Minimum="0"
SmallChange="1"
SpinButtonPlacementMode="Compact"
Value="{x:Bind ViewModel.MouseJumpBorder3dDepth, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard x:Uid="MouseUtils_MouseJump_BorderPadding">
<NumberBox
MinWidth="{StaticResource SettingActionControlMinWidth}"
LargeChange="1"
Maximum="25"
Minimum="0"
SmallChange="1"
SpinButtonPlacementMode="Compact"
Value="{x:Bind ViewModel.MouseJumpBorderPadding, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard x:Uid="MouseUtils_MouseJump_BezelThickness">
<NumberBox
MinWidth="{StaticResource SettingActionControlMinWidth}"
LargeChange="1"
Maximum="25"
Minimum="0"
SmallChange="1"
SpinButtonPlacementMode="Compact"
Value="{x:Bind ViewModel.MouseJumpBezelThickness, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard x:Uid="MouseUtils_MouseJump_BezelColor">
<controls:ColorPickerButton SelectedColor="{x:Bind Path=ViewModel.MouseJumpBezelColor, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard x:Uid="MouseUtils_MouseJump_Bezel3dDepth">
<NumberBox
MinWidth="{StaticResource SettingActionControlMinWidth}"
LargeChange="1"
Maximum="25"
Minimum="0"
SmallChange="1"
SpinButtonPlacementMode="Compact"
Value="{x:Bind ViewModel.MouseJumpBezel3dDepth, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard x:Uid="MouseUtils_MouseJump_ScreenMargin">
<NumberBox
MinWidth="{StaticResource SettingActionControlMinWidth}"
LargeChange="1"
Maximum="25"
Minimum="0"
SmallChange="1"
SpinButtonPlacementMode="Compact"
Value="{x:Bind ViewModel.MouseJumpScreenMargin, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard x:Uid="MouseUtils_MouseJump_ScreenColor1">
<controls:ColorPickerButton SelectedColor="{x:Bind Path=ViewModel.MouseJumpScreenColor1, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard x:Uid="MouseUtils_MouseJump_ScreenColor2">
<controls:ColorPickerButton SelectedColor="{x:Bind Path=ViewModel.MouseJumpScreenColor2, Mode=TwoWay}" />
</tkcontrols:SettingsCard>

<ContentDialog
x:Name="MouseUtils_MouseJump_CopyToCustomStyle_MessageBox"
x:Uid="MouseUtils_MouseJump_CopyToCustomStyle_MessageBox"
IsPrimaryButtonEnabled="{Binding IsValid, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
PrimaryButtonStyle="{ThemeResource AccentButtonStyle}">
<StackPanel>
<TextBlock
x:Uid="MouseUtils_MouseJump_CopyToCustomStyle_MessageBox_Text"
Margin="12,0,0,0"
FontWeight="SemiBold"
Foreground="{ThemeResource AccentTextFillColorPrimaryBrush}"
Style="{StaticResource CaptionTextBlockStyle}" />
</StackPanel>
</ContentDialog>

<tkcontrols:SettingsCard
HorizontalAlignment="Center">
<Image Source="{x:Bind Path=ViewModel.MouseJumpPreviewImage, Mode=OneWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard x:Uid="MouseUtils_MouseJump_PreviewType" x:Name="MouseUtils_MouseJump_PreviewType">
<StackPanel Orientation="Horizontal">
<tkcontrols:Segmented
x:Name="PreviewTypeSetting"
SelectedIndex="{x:Bind ViewModel.MouseJumpPreviewType, Mode=TwoWay, Converter={StaticResource MouseJumpPreviewTypeConverter}}"
SelectionChanged="PreviewTypeSetting_SelectionChanged"
SelectionMode="Single"
Style="{StaticResource ButtonSegmentedStyle}">
<tkcontrols:SegmentedItem>Compact</tkcontrols:SegmentedItem>
<tkcontrols:SegmentedItem>Bezelled</tkcontrols:SegmentedItem>
<tkcontrols:SegmentedItem>Custom</tkcontrols:SegmentedItem>
</tkcontrols:Segmented>
<Button
x:Name="CopyStyleToCustom"
Margin="20,0,0,0"
Click="CopyStyleToCustom_Click"
Content="Copy to Custom preview style"
IsEnabled="{Binding SelectedIndex, ElementName=PreviewTypeSetting}" />
</StackPanel>
</StackPanel>
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard x:Uid="MouseUtils_MouseJump_BackgroundColor1" x:Name="MouseUtils_MouseJump_BackgroundColor1">
<controls:ColorPickerButton SelectedColor="{x:Bind Path=ViewModel.MouseJumpBackgroundColor1, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard x:Uid="MouseUtils_MouseJump_BackgroundColor2" x:Name="MouseUtils_MouseJump_BackgroundColor2">
<controls:ColorPickerButton SelectedColor="{x:Bind Path=ViewModel.MouseJumpBackgroundColor2, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard x:Uid="MouseUtils_MouseJump_BorderThickness" x:Name="MouseUtils_MouseJump_BorderThickness">
<NumberBox
MinWidth="{StaticResource SettingActionControlMinWidth}"
LargeChange="1"
Maximum="25"
Minimum="0"
SmallChange="1"
SpinButtonPlacementMode="Compact"
Value="{x:Bind ViewModel.MouseJumpBorderThickness, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard x:Uid="MouseUtils_MouseJump_BorderColor" x:Name="MouseUtils_MouseJump_BorderColor">
<controls:ColorPickerButton SelectedColor="{x:Bind Path=ViewModel.MouseJumpBorderColor, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard x:Uid="MouseUtils_MouseJump_Border3dDepth" x:Name="MouseUtils_MouseJump_Border3dDepth">
<NumberBox
MinWidth="{StaticResource SettingActionControlMinWidth}"
LargeChange="1"
Maximum="25"
Minimum="0"
SmallChange="1"
SpinButtonPlacementMode="Compact"
Value="{x:Bind ViewModel.MouseJumpBorder3dDepth, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard x:Uid="MouseUtils_MouseJump_BorderPadding" x:Name="MouseUtils_MouseJump_BorderPadding">
<NumberBox
MinWidth="{StaticResource SettingActionControlMinWidth}"
LargeChange="1"
Maximum="25"
Minimum="0"
SmallChange="1"
SpinButtonPlacementMode="Compact"
Value="{x:Bind ViewModel.MouseJumpBorderPadding, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard x:Uid="MouseUtils_MouseJump_BezelThickness" x:Name="MouseUtils_MouseJump_BezelThickness">
<NumberBox
MinWidth="{StaticResource SettingActionControlMinWidth}"
LargeChange="1"
Maximum="25"
Minimum="0"
SmallChange="1"
SpinButtonPlacementMode="Compact"
Value="{x:Bind ViewModel.MouseJumpBezelThickness, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard x:Uid="MouseUtils_MouseJump_BezelColor" x:Name="MouseUtils_MouseJump_BezelColor">
<controls:ColorPickerButton SelectedColor="{x:Bind Path=ViewModel.MouseJumpBezelColor, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard x:Uid="MouseUtils_MouseJump_Bezel3dDepth" x:Name="MouseUtils_MouseJump_Bezel3dDepth">
<NumberBox
MinWidth="{StaticResource SettingActionControlMinWidth}"
LargeChange="1"
Maximum="25"
Minimum="0"
SmallChange="1"
SpinButtonPlacementMode="Compact"
Value="{x:Bind ViewModel.MouseJumpBezel3dDepth, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard x:Uid="MouseUtils_MouseJump_ScreenMargin" x:Name="MouseUtils_MouseJump_ScreenMargin">
<NumberBox
MinWidth="{StaticResource SettingActionControlMinWidth}"
LargeChange="1"
Maximum="25"
Minimum="0"
SmallChange="1"
SpinButtonPlacementMode="Compact"
Value="{x:Bind ViewModel.MouseJumpScreenMargin, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard x:Uid="MouseUtils_MouseJump_ScreenColor1" x:Name="MouseUtils_MouseJump_ScreenColor1">
<controls:ColorPickerButton SelectedColor="{x:Bind Path=ViewModel.MouseJumpScreenColor1, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard x:Uid="MouseUtils_MouseJump_ScreenColor2" x:Name="MouseUtils_MouseJump_ScreenColor2">
<controls:ColorPickerButton SelectedColor="{x:Bind Path=ViewModel.MouseJumpScreenColor2, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
</tkcontrols:SettingsExpander.Items>
</tkcontrols:SettingsExpander>

</controls:SettingsGroup>
<!--
<ContentDialog
x:Name="MouseUtils_MouseJump_CopyToCustomStyle_MessageBox"
x:Uid="MouseUtils_MouseJump_CopyToCustomStyle_MessageBox"
IsPrimaryButtonEnabled="{Binding IsValid, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
PrimaryButtonStyle="{ThemeResource AccentButtonStyle}">
<StackPanel>
<TextBlock
x:Uid="MouseUtils_MouseJump_CopyToCustomStyle_MessageBox_Text"
Margin="12,0,0,0"
FontWeight="SemiBold"
Foreground="{ThemeResource AccentTextFillColorPrimaryBrush}"
Style="{StaticResource CaptionTextBlockStyle}" />
</StackPanel>
</ContentDialog>
-->
</UserControl>
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,34 @@ private void PreviewTypeSetting_SelectionChanged(object sender, SelectionChanged
var selectedPreviewType = this.GetSelectedPreviewType();
var customPreviewTypeSelected = selectedPreviewType == PreviewType.Custom;
this.CopyStyleToCustom.IsEnabled = !customPreviewTypeSelected;
this.CustomStyleSettings.Visibility = customPreviewTypeSelected
var customControlVisibility = customPreviewTypeSelected
? Visibility.Visible
: Visibility.Collapsed;
this.MouseUtils_MouseJump_BackgroundColor1.Visibility = customControlVisibility;
this.MouseUtils_MouseJump_BackgroundColor2.Visibility = customControlVisibility;
this.MouseUtils_MouseJump_BorderThickness.Visibility = customControlVisibility;
this.MouseUtils_MouseJump_BorderColor.Visibility = customControlVisibility;
this.MouseUtils_MouseJump_Border3dDepth.Visibility = customControlVisibility;
this.MouseUtils_MouseJump_BorderPadding.Visibility = customControlVisibility;
this.MouseUtils_MouseJump_BezelThickness.Visibility = customControlVisibility;
this.MouseUtils_MouseJump_BezelColor.Visibility = customControlVisibility;
this.MouseUtils_MouseJump_Bezel3dDepth.Visibility = customControlVisibility;
this.MouseUtils_MouseJump_ScreenMargin.Visibility = customControlVisibility;
this.MouseUtils_MouseJump_ScreenColor1.Visibility = customControlVisibility;
this.MouseUtils_MouseJump_ScreenColor2.Visibility = customControlVisibility;
}

private /* async */ void CopyStyleToCustom_Click(object sender, RoutedEventArgs e)
{
/*
var resourceLoader = ResourceLoaderInstance.ResourceLoader;
var messageBox = this.MouseUtils_MouseJump_CopyToCustomStyle_MessageBox;
messageBox.Title = resourceLoader.GetString("MouseUtils_MouseJump_CopyToCustomStyle_MessageBox_Title");
messageBox.PrimaryButtonText = resourceLoader.GetString("MouseUtils_MouseJump_CopyToCustomStyle_MessageBox_PrimaryButtonText");
messageBox.PrimaryButtonCommand = new RelayCommand(this.MouseUtils_MouseJump_CopyToCustomStyle_MessageBox_PrimaryButtonCommand);
/* await messageBox.ShowAsync(); */
// await messageBox.ShowAsync();
this.MouseUtils_MouseJump_CopyToCustomStyle_MessageBox_PrimaryButtonCommand();
*/
}

private void MouseUtils_MouseJump_CopyToCustomStyle_MessageBox_PrimaryButtonCommand()
Expand Down

0 comments on commit 4782f1b

Please sign in to comment.