Skip to content

Commit

Permalink
1.2.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Mochengvia committed Mar 18, 2024
1 parent 98449bb commit c7269ed
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ static class StyleKeys
public const string DataGridComboBoxStyle = nameof(DataGridComboBoxStyle);
public const string IconButtonStyle = nameof(IconButtonStyle);
public const string IconRepeatButtonStyle = nameof(IconRepeatButtonStyle);
public const string InternalMenuItemStyle = nameof(InternalMenuItemStyle);
public const string SpinStyle = nameof(SpinStyle);
public const string WindowXButtonStyle = nameof(WindowXButtonStyle);
public const string WindowXStyle = nameof(WindowXStyle);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<pw:SharedResourceDictionary Source="pack://application:,,,/Panuon.WPF.UI;component/Templates/MenuItemTemplate.xaml" />
</ResourceDictionary.MergedDictionaries>

<Style x:Key="{x:Static rs:StyleKeys.MenuItemStyle}"
<Style x:Key="{x:Static irs:StyleKeys.InternalMenuItemStyle}"
TargetType="MenuItem">
<Setter Property="i:VisualStateHelper.Regist"
Value="True" />
Expand Down Expand Up @@ -428,4 +428,11 @@
</Style.Triggers>
</Style>

<Style x:Key="{x:Static rs:StyleKeys.MenuItemStyle}"
TargetType="MenuItem"
BasedOn="{StaticResource {x:Static irs:StyleKeys.InternalMenuItemStyle}}">
<Setter Property="ItemContainerStyle"
Value="{StaticResource {x:Static irs:StyleKeys.InternalMenuItemStyle}}" />
</Style>

</ResourceDictionary>
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@
Style="{TemplateBinding ClearButtonStyle}"
Command="{TemplateBinding ClearCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=local:NumberInput}}" />
<Grid Grid.Column="2">
<Grid x:Name="GrdUpDown"
Grid.Column="2"
Visibility="Collapsed">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
Expand Down Expand Up @@ -198,6 +200,71 @@
Property="Visibility"
Value="Visible" />
</MultiDataTrigger>
<Trigger Property="UpDownButtonVisibility"
Value="Visible">
<Setter TargetName="GrdUpDown"
Property="Visibility"
Value="Visible" />
</Trigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding UpDownButtonVisibility, RelativeSource={RelativeSource Self}, Mode=OneWay}"
Value="VisibleOnNonnull" />
<Condition Binding="{Binding Text, Converter={x:Static pw:Converters.IsStringNonnullAndNotEmptyConverter}, RelativeSource={RelativeSource Self}, Mode=OneWay}"
Value="True" />
</MultiDataTrigger.Conditions>
<Setter TargetName="GrdUpDown"
Property="Visibility"
Value="Visible" />
</MultiDataTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="UpDownButtonVisibility"
Value="VisibleOnHover" />
<Condition Property="IsMouseOver"
Value="True" />
</MultiTrigger.Conditions>
<Setter TargetName="GrdUpDown"
Property="Visibility"
Value="Visible" />
</MultiTrigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding UpDownButtonVisibility, RelativeSource={RelativeSource Self}, Mode=OneWay}"
Value="VisibleOnHoverAndNonnull" />
<Condition Binding="{Binding Text, Converter={x:Static pw:Converters.IsStringNonnullAndNotEmptyConverter}, RelativeSource={RelativeSource Self}, Mode=OneWay}"
Value="True" />
<Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}, Mode=OneWay}"
Value="True" />
</MultiDataTrigger.Conditions>
<Setter TargetName="GrdUpDown"
Property="Visibility"
Value="Visible" />
</MultiDataTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="UpDownButtonVisibility"
Value="VisibleOnFocused" />
<Condition Property="IsKeyboardFocusWithin"
Value="True" />
</MultiTrigger.Conditions>
<Setter TargetName="GrdUpDown"
Property="Visibility"
Value="Visible" />
</MultiTrigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding UpDownButtonVisibility, RelativeSource={RelativeSource Self}, Mode=OneWay}"
Value="VisibleOnFocusedAndNonnull" />
<Condition Binding="{Binding Text, Converter={x:Static pw:Converters.IsStringNonnullAndNotEmptyConverter}, RelativeSource={RelativeSource Self}, Mode=OneWay}"
Value="True" />
<Condition Binding="{Binding IsKeyboardFocusWithin, RelativeSource={RelativeSource Self}, Mode=OneWay}"
Value="True" />
</MultiDataTrigger.Conditions>
<Setter TargetName="GrdUpDown"
Property="Visibility"
Value="Visible" />
</MultiDataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</ResourceDictionary>
19 changes: 15 additions & 4 deletions SourceCode/SharedResources/Panuon.WPF.UI/Controls/NumberInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,17 @@ public Brush FocusedWatermarkForeground
VisualStateHelper.FocusedWatermarkForegroundProperty.AddOwner(typeof(NumberInput));
#endregion

#region UpDownButtonVisibility
public AuxiliaryButtonVisibility UpDownButtonVisibility
{
get { return (AuxiliaryButtonVisibility)GetValue(UpDownButtonVisibilityProperty); }
set { SetValue(UpDownButtonVisibilityProperty, value); }
}

public static readonly DependencyProperty UpDownButtonVisibilityProperty =
DependencyProperty.Register("UpDownButtonVisibility", typeof(AuxiliaryButtonVisibility), typeof(NumberInput), new PropertyMetadata(AuxiliaryButtonVisibility.Visible));
#endregion

#region UpDownButtonStyle
public static Style GetUpDownButtonStyle(NumberInput numberInput)
{
Expand Down Expand Up @@ -383,25 +394,25 @@ internal ICommand ClearCommand
#endregion

#region UpCommand
internal ICommand UpCommand
public ICommand UpCommand
{
get { return (ICommand)GetValue(UpCommandProperty); }
}

internal static readonly DependencyPropertyKey UpCommandPropertyKey =
public static readonly DependencyPropertyKey UpCommandPropertyKey =
DependencyProperty.RegisterReadOnly("UpCommand", typeof(ICommand), typeof(NumberInput), new PropertyMetadata(new RelayCommand<NumberInput>(OnUpCommandExecute)));

public static readonly DependencyProperty UpCommandProperty =
UpCommandPropertyKey.DependencyProperty;
#endregion

#region DownCommand
internal ICommand DownCommand
public ICommand DownCommand
{
get { return (ICommand)GetValue(DownCommandProperty); }
}

internal static readonly DependencyPropertyKey DownCommandPropertyKey =
public static readonly DependencyPropertyKey DownCommandPropertyKey =
DependencyProperty.RegisterReadOnly("DownCommand", typeof(ICommand), typeof(NumberInput), new PropertyMetadata(new RelayCommand<NumberInput>(OnDownCommandExecute)));

public static readonly DependencyProperty DownCommandProperty =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@
ResourceDictionaryLocation.SourceAssembly
)]

[assembly: AssemblyVersion("1.2.0.1")]
[assembly: AssemblyFileVersion("1.2.0.1")]
[assembly: AssemblyVersion("1.2.0.2")]
[assembly: AssemblyFileVersion("1.2.0.2")]

0 comments on commit c7269ed

Please sign in to comment.