-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Set size of DashedLine explicitly #1772
Set size of DashedLine explicitly #1772
Conversation
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.
Really great working tracking this down. Thank you
@@ -486,6 +486,8 @@ | |||
Grid.ColumnSpan="2" | |||
Grid.Column="0" | |||
VerticalAlignment="Bottom" | |||
Height="{Binding BorderThickness.Bottom, ElementName=toggleButton, Converter={StaticResource DivisionMathConverter}, ConverterParameter=0.75}" |
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.
Though this works, binding to BorderTickness.Bottom
exposes a memory leak (the Binding leak section) because BorderThickeness
is a just a Thickness struct. It actually appears that we have the same bug on the StrokeThickness
as well. I would propose the following fixes:
- Since it looks like we are trying to keep these properties in sync, why not simply bind the Height to the StrokeHeight property.
{Binding StrokeHeight, RelativeSource={RelativeSource Self}}
- Rather than binding through the BorderThickness property, lets create a value converter that takes in the
BorderThickness
directly, and applies the appropriate math we need for this line. I would propose that this converter be made internal for now.
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.
Good points. I have implemented those. 👍
Resolves #1735
I found that this trigger caused the high CPU usage:
MaterialDesignInXamlToolkit/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.TextBox.xaml
Lines 278 to 285 in 71af777
So I guess that the disabled
DashedLine
(disabled, because of placement inRightDrawerContent
) had no fix size. So I set it:MaterialDesignInXamlToolkit/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.TextBox.xaml
Lines 165 to 166 in 71af777
and the CPU usage was gone.
Beside
MaterialDesignTheme.TextBox.xaml
I updated other controls, since they seems to have a similarDashedLine
MaterialDesignTheme.ComboBox.xaml
MaterialDesignTheme.DatePicker.xaml
MaterialDesignTheme.PasswordBox.xaml
MaterialDesignTheme.TimePicker.xaml
PS: I also updated the Fields.xaml in demo app, where I forgot the disabled fields during #1749 :-(