-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Add new options to the ExpanderAssist class #3294
Add new options to the ExpanderAssist class #3294
Conversation
- ExpanderPosition: to set the position of the Expander Icon --> Start: at the start of the header --> End: at the end of the header - CollapsedIcon: to set the icon when the expander is collapsed - ExpandedIcon: to set the icon when the expander is expanded
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.
Two things.
-
It appears that it is only implemented for Expand direction Up and Down. This should also support ExpandDirection Left and Right (this is the 3a expanders in the demo app).
-
Rather than having two attached properties, I think a single one for the ToggleButton's content will work. Perhaps called something like
ExpanderButtonContent
(or similar). I think naming it so that consumers realize that it accepts arbitrary content, rather than just icons. The caller can then toggle it doing something like this:
<Expander.Style>
<Style TargetType="Expander" BasedOn="{StaticResource MaterialDesignExpander}">
<Setter Property="materialDesign:ExpanderAssist.ExpanderButtonContent" Value="{materialDesign:PackIcon Kind=Minus}" />
<Style.Triggers>
<Trigger Property="IsExpanded" Value="True">
<Setter Property="materialDesign:ExpanderAssist.ExpanderButtonContent" Value="{materialDesign:PackIcon Kind=Plus}" />
</Trigger>
</Style.Triggers>
</Style>
</Expander.Style>
Hello @Keboo
|
Hello @Keboo , I've made some changes following your review. I combined the two properties, "Collapse" and "Expand" icons, into a single property called ExpanderButtonContent. Additionally, I renamed the "ExpanderPosition" property to ExpanderButtonPosition. I have a question: is it possible to utilize these properties in the TreeView as well? This would allow for altering the expander button's content and position using the same assistant. |
…ExpanderButtonContent. Rename the ExpanderPosition to ExpanderButtonPosition.
This is true, but we also use it in the Expander style to swap to a different header template. I would expect that we need to add similar triggers for changing the expanding icon in the vertical template as well. |
I think we could do something similar for tree view, but I would make it a new property on the TreeViewAssist class rather than re-using this one. |
Added new default button position to support different default for vertical and horizontal.
--> Start: at the start of the header materialDesign:ExpanderAssist.ExpanderPosition="Start"
--> End: at the end of the header materialDesign:ExpanderAssist.ExpanderPosition="End"
--> materialDesign:ExpanderAssist.CollapcedIcon="{materialDesign:PackIcon Kind=Plus}"
--> materialDesign:ExpanderAssist.ExpandedIcon="{materialDesign:PackIcon Kind=Minus}"