Skip to content

Commit

Permalink
Button* -> *Button
Browse files Browse the repository at this point in the history
  • Loading branch information
NotYoojun committed Jul 1, 2024
1 parent ec264eb commit 9cbca0a
Show file tree
Hide file tree
Showing 6 changed files with 121 additions and 121 deletions.
6 changes: 3 additions & 3 deletions samples/WindowExample/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@
</Grid.RowDefinitions>

<TextBlock Text="Minimize button" Grid.Column="0" Margin="4"/>
<ComboBox x:Name="ComboBox_TitleBarButtonMinimizeAvailability_Minimize" Grid.Column="0" Tag="{x:Static ui:TitleBar.ButtonMinimizeAvailabilityProperty}" Style="{StaticResource TitleBarButtonAvailabilitySelector}"/>
<ComboBox x:Name="ComboBox_TitleBarMinimizeButtonAvailability_Minimize" Grid.Column="0" Tag="{x:Static ui:TitleBar.MinimizeButtonAvailabilityProperty}" Style="{StaticResource TitleBarButtonAvailabilitySelector}"/>

<TextBlock Text="Maximize button" Grid.Column="1" Margin="4"/>
<ComboBox x:Name="ComboBox_TitleBarButtonMaximizeAvailability_Minimize" Grid.Column="1" Tag="{x:Static ui:TitleBar.ButtonMaximizeAvailabilityProperty}" Style="{StaticResource TitleBarButtonAvailabilitySelector}"/>
<ComboBox x:Name="ComboBox_TitleBarMaximizeButtonAvailability_Minimize" Grid.Column="1" Tag="{x:Static ui:TitleBar.MaximizeButtonAvailabilityProperty}" Style="{StaticResource TitleBarButtonAvailabilitySelector}"/>

<TextBlock Text="Close button" Grid.Column="2" Margin="4"/>
<ComboBox x:Name="ComboBox_TitleBarButtonCloseAvailability_Minimize" Grid.Column="2" Tag="{x:Static ui:TitleBar.ButtonCloseAvailabilityProperty}" Style="{StaticResource TitleBarButtonAvailabilitySelector}"/>
<ComboBox x:Name="ComboBox_TitleBarCloseButtonAvailability_Minimize" Grid.Column="2" Tag="{x:Static ui:TitleBar.CloseButtonAvailabilityProperty}" Style="{StaticResource TitleBarButtonAvailabilitySelector}"/>


</Grid>
Expand Down
38 changes: 19 additions & 19 deletions source/iNKORE.UI.WPF.Modern/Controls/Primitives/TitleBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -390,60 +390,60 @@ public static void SetHeight(Window window, double value)

#endregion

#region ButtonCloseAvailability
#region CloseButtonAvailability

public static readonly DependencyProperty ButtonCloseAvailabilityProperty =
public static readonly DependencyProperty CloseButtonAvailabilityProperty =
DependencyProperty.RegisterAttached(
"ButtonCloseAvailability",
"CloseButtonAvailability",
typeof(TitleBarButtonAvailability),
typeof(TitleBar),
new PropertyMetadata(TitleBarButtonAvailability.Auto));


public static TitleBarButtonAvailability GetButtonCloseAvailability(Window window)
public static TitleBarButtonAvailability GetCloseButtonAvailability(Window window)
{
return (TitleBarButtonAvailability)window.GetValue(ButtonCloseAvailabilityProperty);
return (TitleBarButtonAvailability)window.GetValue(CloseButtonAvailabilityProperty);
}

public static void SetButtonCloseAvailability(Window window, TitleBarButtonAvailability value)
public static void SetCloseButtonAvailability(Window window, TitleBarButtonAvailability value)
{
window.SetValue(ButtonCloseAvailabilityProperty, value);
window.SetValue(CloseButtonAvailabilityProperty, value);
}

public static readonly DependencyProperty ButtonMaximizeAvailabilityProperty =
public static readonly DependencyProperty MaximizeButtonAvailabilityProperty =
DependencyProperty.RegisterAttached(
"ButtonMaximizeAvailability",
"MaximizeButtonAvailability",
typeof(TitleBarButtonAvailability),
typeof(TitleBar),
new PropertyMetadata(TitleBarButtonAvailability.Auto));


public static TitleBarButtonAvailability GetButtonMaximizeAvailability(Window window)
public static TitleBarButtonAvailability GetMaximizeButtonAvailability(Window window)
{
return (TitleBarButtonAvailability)window.GetValue(ButtonMaximizeAvailabilityProperty);
return (TitleBarButtonAvailability)window.GetValue(MaximizeButtonAvailabilityProperty);
}

public static void SetButtonMaximizeAvailability(Window window, TitleBarButtonAvailability value)
public static void SetMaximizeButtonAvailability(Window window, TitleBarButtonAvailability value)
{
window.SetValue(ButtonMaximizeAvailabilityProperty, value);
window.SetValue(MaximizeButtonAvailabilityProperty, value);
}

public static readonly DependencyProperty ButtonMinimizeAvailabilityProperty =
public static readonly DependencyProperty MinimizeButtonAvailabilityProperty =
DependencyProperty.RegisterAttached(
"ButtonMinimizeAvailability",
"MinimizeButtonAvailability",
typeof(TitleBarButtonAvailability),
typeof(TitleBar),
new PropertyMetadata(TitleBarButtonAvailability.Auto));


public static TitleBarButtonAvailability GetButtonMinimizeAvailability(Window window)
public static TitleBarButtonAvailability GetMinimizeButtonAvailability(Window window)
{
return (TitleBarButtonAvailability)window.GetValue(ButtonMinimizeAvailabilityProperty);
return (TitleBarButtonAvailability)window.GetValue(MinimizeButtonAvailabilityProperty);
}

public static void SetButtonMinimizeAvailability(Window window, TitleBarButtonAvailability value)
public static void SetMinimizeButtonAvailability(Window window, TitleBarButtonAvailability value)
{
window.SetValue(ButtonMinimizeAvailabilityProperty, value);
window.SetValue(MinimizeButtonAvailabilityProperty, value);
}

#endregion
Expand Down
94 changes: 47 additions & 47 deletions source/iNKORE.UI.WPF.Modern/Controls/Primitives/TitleBarControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -352,59 +352,59 @@ private static void ButtonAvailabilityProperty_ValueChanged(DependencyObject d,
(d as TitleBarControl)?.RefreshButtonActualAvailabilities();
}

public static readonly DependencyProperty ButtonCloseAvailabilityProperty =
TitleBar.ButtonCloseAvailabilityProperty.AddOwner(typeof(TitleBarControl), new PropertyMetadata(TitleBarButtonAvailability.Auto, ButtonAvailabilityProperty_ValueChanged));
public static readonly DependencyProperty CloseButtonAvailabilityProperty =
TitleBar.CloseButtonAvailabilityProperty.AddOwner(typeof(TitleBarControl), new PropertyMetadata(TitleBarButtonAvailability.Auto, ButtonAvailabilityProperty_ValueChanged));

public TitleBarButtonAvailability ButtonCloseAvailability
public TitleBarButtonAvailability CloseButtonAvailability
{
get => (TitleBarButtonAvailability)GetValue(ButtonCloseAvailabilityProperty);
set => SetValue(ButtonCloseAvailabilityProperty, value);
get => (TitleBarButtonAvailability)GetValue(CloseButtonAvailabilityProperty);
set => SetValue(CloseButtonAvailabilityProperty, value);
}

// User-customized values

public static readonly DependencyProperty ButtonMinimizeAvailabilityProperty =
TitleBar.ButtonMinimizeAvailabilityProperty.AddOwner(typeof(TitleBarControl), new PropertyMetadata(TitleBarButtonAvailability.Auto, ButtonAvailabilityProperty_ValueChanged));
public static readonly DependencyProperty MinimizeButtonAvailabilityProperty =
TitleBar.MinimizeButtonAvailabilityProperty.AddOwner(typeof(TitleBarControl), new PropertyMetadata(TitleBarButtonAvailability.Auto, ButtonAvailabilityProperty_ValueChanged));

public TitleBarButtonAvailability ButtonMinimizeAvailability
public TitleBarButtonAvailability MinimizeButtonAvailability
{
get => (TitleBarButtonAvailability)GetValue(ButtonMinimizeAvailabilityProperty);
set => SetValue(ButtonMinimizeAvailabilityProperty, value);
get => (TitleBarButtonAvailability)GetValue(MinimizeButtonAvailabilityProperty);
set => SetValue(MinimizeButtonAvailabilityProperty, value);
}

public static readonly DependencyProperty ButtonMaximizeAvailabilityProperty =
TitleBar.ButtonMaximizeAvailabilityProperty.AddOwner(typeof(TitleBarControl), new PropertyMetadata(TitleBarButtonAvailability.Auto, ButtonAvailabilityProperty_ValueChanged));
public static readonly DependencyProperty MaximizeButtonAvailabilityProperty =
TitleBar.MaximizeButtonAvailabilityProperty.AddOwner(typeof(TitleBarControl), new PropertyMetadata(TitleBarButtonAvailability.Auto, ButtonAvailabilityProperty_ValueChanged));

public TitleBarButtonAvailability ButtonMaximizeAvailability
public TitleBarButtonAvailability MaximizeButtonAvailability
{
get => (TitleBarButtonAvailability)GetValue(ButtonMaximizeAvailabilityProperty);
set => SetValue(ButtonMaximizeAvailabilityProperty, value);
get => (TitleBarButtonAvailability)GetValue(MaximizeButtonAvailabilityProperty);
set => SetValue(MaximizeButtonAvailabilityProperty, value);
}

// Actual values

public static readonly DependencyPropertyKey ButtonCloseActualAvailabilityPropertyKey = DependencyProperty.RegisterReadOnly(nameof(ButtonCloseActualAvailability), typeof(TitleBarButtonAvailability), typeof(TitleBarControl), new PropertyMetadata(TitleBarButtonAvailability.Enabled));
public static readonly DependencyProperty ButtonCloseActualAvailabilityProperty = ButtonCloseActualAvailabilityPropertyKey.DependencyProperty;
public TitleBarButtonAvailability ButtonCloseActualAvailability
public static readonly DependencyPropertyKey CloseButtonActualAvailabilityPropertyKey = DependencyProperty.RegisterReadOnly(nameof(CloseButtonActualAvailability), typeof(TitleBarButtonAvailability), typeof(TitleBarControl), new PropertyMetadata(TitleBarButtonAvailability.Enabled));
public static readonly DependencyProperty CloseButtonActualAvailabilityProperty = CloseButtonActualAvailabilityPropertyKey.DependencyProperty;
public TitleBarButtonAvailability CloseButtonActualAvailability
{
get => (TitleBarButtonAvailability)GetValue(ButtonCloseActualAvailabilityProperty);
private set => SetValue(ButtonCloseActualAvailabilityPropertyKey, value);
get => (TitleBarButtonAvailability)GetValue(CloseButtonActualAvailabilityProperty);
private set => SetValue(CloseButtonActualAvailabilityPropertyKey, value);
}

public static readonly DependencyPropertyKey ButtonMaximizeActualAvailabilityPropertyKey = DependencyProperty.RegisterReadOnly(nameof(ButtonMaximizeActualAvailability), typeof(TitleBarButtonAvailability), typeof(TitleBarControl), new PropertyMetadata(TitleBarButtonAvailability.Enabled));
public static readonly DependencyProperty ButtonMaximizeActualAvailabilityProperty = ButtonMaximizeActualAvailabilityPropertyKey.DependencyProperty;
public TitleBarButtonAvailability ButtonMaximizeActualAvailability
public static readonly DependencyPropertyKey MaximizeButtonActualAvailabilityPropertyKey = DependencyProperty.RegisterReadOnly(nameof(MaximizeButtonActualAvailability), typeof(TitleBarButtonAvailability), typeof(TitleBarControl), new PropertyMetadata(TitleBarButtonAvailability.Enabled));
public static readonly DependencyProperty MaximizeButtonActualAvailabilityProperty = MaximizeButtonActualAvailabilityPropertyKey.DependencyProperty;
public TitleBarButtonAvailability MaximizeButtonActualAvailability
{
get => (TitleBarButtonAvailability)GetValue(ButtonMaximizeActualAvailabilityProperty);
private set => SetValue(ButtonMaximizeActualAvailabilityPropertyKey, value);
get => (TitleBarButtonAvailability)GetValue(MaximizeButtonActualAvailabilityProperty);
private set => SetValue(MaximizeButtonActualAvailabilityPropertyKey, value);
}

public static readonly DependencyPropertyKey ButtonMinimizeActualAvailabilityPropertyKey = DependencyProperty.RegisterReadOnly(nameof(ButtonMinimizeActualAvailability), typeof(TitleBarButtonAvailability), typeof(TitleBarControl), new PropertyMetadata(TitleBarButtonAvailability.Enabled));
public static readonly DependencyProperty ButtonMinimizeActualAvailabilityProperty = ButtonMinimizeActualAvailabilityPropertyKey.DependencyProperty;
public TitleBarButtonAvailability ButtonMinimizeActualAvailability
public static readonly DependencyPropertyKey MinimizeButtonActualAvailabilityPropertyKey = DependencyProperty.RegisterReadOnly(nameof(MinimizeButtonActualAvailability), typeof(TitleBarButtonAvailability), typeof(TitleBarControl), new PropertyMetadata(TitleBarButtonAvailability.Enabled));
public static readonly DependencyProperty MinimizeButtonActualAvailabilityProperty = MinimizeButtonActualAvailabilityPropertyKey.DependencyProperty;
public TitleBarButtonAvailability MinimizeButtonActualAvailability
{
get => (TitleBarButtonAvailability)GetValue(ButtonMinimizeActualAvailabilityProperty);
private set => SetValue(ButtonMinimizeActualAvailabilityPropertyKey, value);
get => (TitleBarButtonAvailability)GetValue(MinimizeButtonActualAvailabilityProperty);
private set => SetValue(MinimizeButtonActualAvailabilityPropertyKey, value);
}

#endregion
Expand Down Expand Up @@ -535,69 +535,69 @@ public void RefreshButtonActualAvailabilities()
{

// Close button
if (ButtonCloseAvailability != TitleBarButtonAvailability.Auto)
if (CloseButtonAvailability != TitleBarButtonAvailability.Auto)
{
ButtonCloseActualAvailability = ButtonCloseAvailability;
CloseButtonActualAvailability = CloseButtonAvailability;
}
else
{
if (_parentWindow.WindowStyle == WindowStyle.None)
{
ButtonCloseActualAvailability = TitleBarButtonAvailability.Collapsed;
CloseButtonActualAvailability = TitleBarButtonAvailability.Collapsed;
}
else
{
ButtonCloseActualAvailability = TitleBarButtonAvailability.Enabled;
CloseButtonActualAvailability = TitleBarButtonAvailability.Enabled;
}
}

// Maximize button
if (ButtonMaximizeAvailability != TitleBarButtonAvailability.Auto)
if (MaximizeButtonAvailability != TitleBarButtonAvailability.Auto)
{
ButtonMaximizeActualAvailability = ButtonMaximizeAvailability;
MaximizeButtonActualAvailability = MaximizeButtonAvailability;
}
else
{
if(_parentWindow.WindowStyle == WindowStyle.ToolWindow)
{
ButtonMaximizeActualAvailability = TitleBarButtonAvailability.Collapsed;
MaximizeButtonActualAvailability = TitleBarButtonAvailability.Collapsed;
}
else if (_parentWindow.WindowStyle == WindowStyle.None)
{
ButtonMaximizeActualAvailability = TitleBarButtonAvailability.Collapsed;
MaximizeButtonActualAvailability = TitleBarButtonAvailability.Collapsed;
}
else
{
switch (_parentWindow.ResizeMode)
{
case ResizeMode.CanMinimize:
ButtonMaximizeActualAvailability = TitleBarButtonAvailability.Disabled;
MaximizeButtonActualAvailability = TitleBarButtonAvailability.Disabled;
break;
case ResizeMode.CanResizeWithGrip:
case ResizeMode.CanResize:
ButtonMaximizeActualAvailability = TitleBarButtonAvailability.Enabled;
MaximizeButtonActualAvailability = TitleBarButtonAvailability.Enabled;
break;
case ResizeMode.NoResize:
ButtonMaximizeActualAvailability = TitleBarButtonAvailability.Collapsed;
MaximizeButtonActualAvailability = TitleBarButtonAvailability.Collapsed;
break;
}
}
}

// Minimize button
if (ButtonMinimizeAvailability != TitleBarButtonAvailability.Auto)
if (MinimizeButtonAvailability != TitleBarButtonAvailability.Auto)
{
ButtonMinimizeActualAvailability = ButtonMinimizeAvailability;
MinimizeButtonActualAvailability = MinimizeButtonAvailability;
}
else
{
if (_parentWindow.WindowStyle == WindowStyle.ToolWindow)
{
ButtonMinimizeActualAvailability = TitleBarButtonAvailability.Collapsed;
MinimizeButtonActualAvailability = TitleBarButtonAvailability.Collapsed;
}
else if (_parentWindow.WindowStyle == WindowStyle.None)
{
ButtonMinimizeActualAvailability = TitleBarButtonAvailability.Collapsed;
MinimizeButtonActualAvailability = TitleBarButtonAvailability.Collapsed;
}
else
{
Expand All @@ -606,10 +606,10 @@ public void RefreshButtonActualAvailabilities()
case ResizeMode.CanMinimize:
case ResizeMode.CanResizeWithGrip:
case ResizeMode.CanResize:
ButtonMinimizeActualAvailability = TitleBarButtonAvailability.Enabled;
MinimizeButtonActualAvailability = TitleBarButtonAvailability.Enabled;
break;
case ResizeMode.NoResize:
ButtonMinimizeActualAvailability = TitleBarButtonAvailability.Collapsed;
MinimizeButtonActualAvailability = TitleBarButtonAvailability.Collapsed;
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
ContentTemplate="{StaticResource IconTemplate}"
IsActive="{TemplateBinding IsActive}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
Availability="{TemplateBinding ButtonMinimizeActualAvailability}"
Availability="{TemplateBinding MinimizeButtonActualAvailability}"
Style="{TemplateBinding ButtonStyle}" />

<primitives:TitleBarButton
Expand All @@ -118,7 +118,7 @@
IsActive="{TemplateBinding IsActive}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
Style="{TemplateBinding ButtonStyle}"
Availability="{TemplateBinding ButtonMaximizeActualAvailability}"
Availability="{TemplateBinding MaximizeButtonActualAvailability}"
Height="{Binding ElementName=PART_RightSystemOverlay, Path=ActualHeight}"/>

<primitives:TitleBarButton
Expand All @@ -133,7 +133,7 @@
PressedBackground="#F1707A"
PressedForeground="{DynamicResource SystemControlBackgroundChromeWhiteBrush}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
Availability="{TemplateBinding ButtonCloseActualAvailability}"
Availability="{TemplateBinding CloseButtonActualAvailability}"
Style="{TemplateBinding ButtonStyle}" />
</StackPanel>
</Grid>
Expand Down
Loading

0 comments on commit 9cbca0a

Please sign in to comment.