Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix row count setting #941

Merged
merged 1 commit into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions RetroBar/Converters/CountToIndexConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;
using System.Globalization;
using System.Windows.Data;

namespace RetroBar.Converters
{
public class CountToIndexConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return (int)value - 1;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return (int)value + 1;
}
}
}
4 changes: 3 additions & 1 deletion RetroBar/PropertiesWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<converters:BoolToTextRenderingModeConverter x:Key="textRenderingModeConverter" />
<converters:BoolToVisibilityConverter x:Key="boolToVisibilityConverter" />
<converters:BoolToInvertedVisibilityConverter x:Key="boolToInvertedVisibilityConverter" />
<converters:CountToIndexConverter x:Key="countToIndexConverter" />
<converters:DoubleToPercentConverter x:Key="doubleToPercentConverter" />
<converters:EnumConverter x:Key="enumConverter" />
<converters:EdgeIsHorizontalConverter x:Key="isHorizontalConverter" />
Expand Down Expand Up @@ -212,7 +213,8 @@
</Label>
<ComboBox x:Name="cbRowCount"
ItemsSource="{DynamicResource rowcount_options}"
SelectedValue="{Binding Source={x:Static Settings:Settings.Instance}, Path=RowCount, UpdateSourceTrigger=PropertyChanged}" />
SelectedIndex="{Binding Source={x:Static Settings:Settings.Instance}, Path=RowCount, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource countToIndexConverter}}"
SelectionChanged="cbRowCount_SelectionChanged" />
</DockPanel>
<CheckBox IsChecked="{Binding Source={x:Static Settings:Settings.Instance}, Path=AllowFontSmoothing, UpdateSourceTrigger=PropertyChanged}">
<Label Content="{DynamicResource allow_font_smoothing}" />
Expand Down
8 changes: 8 additions & 0 deletions RetroBar/PropertiesWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,14 @@ private void cboMiddleMouseAction_SelectionChanged(object sender, System.Windows
}
}

private void cbRowCount_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
if (cbRowCount.SelectedItem == null)
{
cbRowCount.SelectedValue = cbRowCount.Items[Settings.Instance.RowCount - 1];
}
}

private void CustomizeNotifications_OnClick(object sender, RoutedEventArgs e)
{
OpenCustomizeNotifications();
Expand Down