-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Some fixes in NumericUpDown #2245
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
Changes from 8 commits
242bd7e
7535999
de37398
a0fd2f8
7501fc3
4ca15a2
d5ebd7c
d5699cb
fd20c25
6116aa5
c9dbbdc
e159c97
b19929a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
xmlns:converters="clr-namespace:MahApps.Metro.Converters"> | ||
|
||
<ResourceDictionary.MergedDictionaries> | ||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/VS/Colors.xaml" /> | ||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Shared.xaml" /> | ||
</ResourceDictionary.MergedDictionaries> | ||
|
||
<converters:ThicknessToDoubleConverter x:Key="ThicknessToDoubleConverter" /> | ||
|
@@ -68,8 +68,31 @@ | |
<ColumnDefinition x:Name="PART_NumericDownColumn" | ||
Width="Auto" /> | ||
</Grid.ColumnDefinitions> | ||
|
||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto"></RowDefinition> | ||
<RowDefinition Height="*"></RowDefinition> | ||
</Grid.RowDefinitions> | ||
<Grid x:Name="PART_FloatingMessageContainer" | ||
Grid.Column="0" | ||
Height="0" | ||
IsHitTestVisible="False" | ||
Margin="5,0" | ||
Visibility="Visible"> | ||
<TextBlock x:Name="PART_FloatingMessage" | ||
Text="{TemplateBinding Controls:TextBoxHelper.Watermark}" | ||
FontSize="{DynamicResource FloatingWatermarkFontSize}" | ||
Foreground="{TemplateBinding Foreground}" | ||
Opacity="0.6" | ||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | ||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"> | ||
<TextBlock.RenderTransform> | ||
<TranslateTransform /> | ||
</TextBlock.RenderTransform> | ||
</TextBlock> | ||
</Grid> | ||
<TextBox x:Name="PART_TextBox" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @xxMUROxx can you change the floating message part like in 1919458 ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @punker76 do you mean removing PART_FloatingMessage There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @xxMUROxx no, i mean changeing Grid -> ContentControl and the tirgger part |
||
Grid.Row="1" | ||
Grid.Column="0" | ||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" | ||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" | ||
Controls:ControlsHelper.DisabledVisualElementVisibility="Collapsed" | ||
|
@@ -94,6 +117,7 @@ | |
Controls:TextBoxHelper.ButtonsAlignment="{TemplateBinding ButtonsAlignment}" /> | ||
<RepeatButton x:Name="PART_NumericUp" | ||
Grid.Column="1" | ||
Grid.RowSpan="2" | ||
Margin="2,2,0,2" | ||
Delay="{TemplateBinding Delay}" | ||
Foreground="{TemplateBinding Foreground}" | ||
|
@@ -109,6 +133,7 @@ | |
</RepeatButton> | ||
<RepeatButton x:Name="PART_NumericDown" | ||
Grid.Column="2" | ||
Grid.RowSpan="2" | ||
Margin="0,2,2,2" | ||
VerticalContentAlignment="Center" | ||
Delay="{TemplateBinding Delay}" | ||
|
@@ -134,6 +159,36 @@ | |
Opacity="0" /> | ||
</Grid> | ||
<ControlTemplate.Triggers> | ||
<!--Sets the MiniMessage visibility (Watermark must not be "" and FloatWatermark must be true)--> | ||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=(Controls:TextBoxHelper.HasText)}" | ||
Value="False"> | ||
<DataTrigger.EnterActions> | ||
<BeginStoryboard Storyboard="{StaticResource HideFloatingMessageStoryboard}" /> | ||
</DataTrigger.EnterActions> | ||
<DataTrigger.ExitActions> | ||
<BeginStoryboard Storyboard="{StaticResource ShowFloatingMessageStoryboard}" /> | ||
</DataTrigger.ExitActions> | ||
</DataTrigger> | ||
<!--To override Watermark == ""--> | ||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=(Controls:TextBoxHelper.Watermark)}" | ||
Value=""> | ||
<DataTrigger.EnterActions> | ||
<BeginStoryboard Storyboard="{StaticResource HideFloatingMessageStoryboard}" /> | ||
</DataTrigger.EnterActions> | ||
<DataTrigger.ExitActions> | ||
<BeginStoryboard Storyboard="{StaticResource ShowFloatingMessageStoryboard}" /> | ||
</DataTrigger.ExitActions> | ||
</DataTrigger> | ||
<!--To override TextBoxHelper.UseFloatingWatermark == false--> | ||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=(Controls:TextBoxHelper.UseFloatingWatermark)}" | ||
Value="False"> | ||
<DataTrigger.EnterActions> | ||
<BeginStoryboard Storyboard="{StaticResource HideFloatingMessageStoryboard}" /> | ||
</DataTrigger.EnterActions> | ||
<DataTrigger.ExitActions> | ||
<BeginStoryboard Storyboard="{StaticResource ShowFloatingMessageStoryboard}" /> | ||
</DataTrigger.ExitActions> | ||
</DataTrigger> | ||
<Trigger Property="ButtonsAlignment" | ||
Value="Left"> | ||
<Setter TargetName="PART_TextBox" | ||
|
@@ -234,7 +289,14 @@ | |
<Setter TargetName="Base" | ||
Property="BorderBrush" | ||
Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Controls:ControlsHelper.FocusBorderBrush)}" /> | ||
<Setter TargetName="PART_FloatingMessage" | ||
Property="Foreground" | ||
Value="{DynamicResource AccentColorBrush}" /> | ||
<Setter TargetName="PART_FloatingMessage" | ||
Property="Opacity" | ||
Value="1" /> | ||
</Trigger> | ||
|
||
|
||
<Trigger Property="HideUpDownButtons" | ||
Value="True"> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xxMUROxx do we really need this
static
stuff? cause every func is only used once...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@punker76 we could also inline this fields. But what do you think of both generic methods? Should simplify further development if we add UseFloatingWatermark for other controls.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@punker76 done