Set size of DashedLine explicitly#1772
Merged
Keboo merged 5 commits intoApr 27, 2020
Merged
Conversation
Keboo
reviewed
Apr 26, 2020
Member
Keboo
left a comment
There was a problem hiding this comment.
Really great working tracking this down. Thank you
| Grid.ColumnSpan="2" | ||
| Grid.Column="0" | ||
| VerticalAlignment="Bottom" | ||
| Height="{Binding BorderThickness.Bottom, ElementName=toggleButton, Converter={StaticResource DivisionMathConverter}, ConverterParameter=0.75}" |
Member
There was a problem hiding this comment.
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
BorderThicknessdirectly, and applies the appropriate math we need for this line. I would propose that this converter be made internal for now.
Contributor
Author
There was a problem hiding this comment.
Good points. I have implemented those. 👍
Keboo
approved these changes
Apr 27, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.xamlI updated other controls, since they seems to have a similarDashedLineMaterialDesignTheme.ComboBox.xamlMaterialDesignTheme.DatePicker.xamlMaterialDesignTheme.PasswordBox.xamlMaterialDesignTheme.TimePicker.xamlPS: I also updated the Fields.xaml in demo app, where I forgot the disabled fields during #1749 :-(