Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

nicolaihenriksen
Copy link
Contributor

@nicolaihenriksen nicolaihenriksen commented Nov 23, 2023

This PR adds a SplitButton to the MDIX library by introducing a SplitButton custom control which is a composite control consisting of a normal Button and a PopupBox next to it. It tries to leverage the existing button styles to avoid too much maintenance work.


PROs:

  • Discoverability (independent control residing in the MDIX namespace)
  • Hope to have fine grained control if tweaks are needed that should not affect normal buttons (may need some work though!)
  • Does not impact the visual tree of normal buttons

CONs:

  • Some level of duplication is still present, but not a whole lot

NOTE: I opted to not use the new cool resource key stuff generated by mdresgen yet. It will probably require changes in the Button templates as well, and as such I would rather get this in and then open a new PR where I can try to use the new features of the theme generation.


Demo apps are extended with the following (on the Buttons page) showcasing all currently added styles:
image

Example usage is something along these lines:

<materialDesign:SplitButton Content="Split Button"
                            Style="{StaticResource MaterialDesignOutlinedSplitButton}"
                            PopupPlacementMode="TopAndAlignRightEdges">
  <materialDesign:SplitButton.PopupContent>
    ...
  </materialDesign:SplitButton.PopupContent>
</materialDesign:SplitButton>

@tim-gromeyer
Copy link

This is exactly what I was looking for. Would be very useful to have in my project. Being a beginner, I haven't been able to create such a button yet. I tried it several times but there was always something not working. Looking forward to this being merged!

@nicolaihenriksen
Copy link
Contributor Author

Looking forward to this being merged!

It still needs a bit of work though 😃

@nicolaihenriksen nicolaihenriksen force-pushed the splitButtonUsingPopupBox branch from 3741c36 to 7ba11b6 Compare December 6, 2023 14:33
@nicolaihenriksen nicolaihenriksen marked this pull request as ready for review December 6, 2023 14:38
@Keboo Keboo added this to the 5.0.0 milestone Dec 7, 2023
@Keboo Keboo added the release notes Items are likely to be highlighted in the release notes. label Dec 7, 2023
Copy link
Member

@Keboo Keboo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good so far.
Would like to see UI tests get implemented. I started on this work and left some comments on things to do (the tests are not all passing yet).

Specifically tests on Click event and Command would be good to do

@Keboo Keboo enabled auto-merge (squash) December 8, 2023 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release notes Items are likely to be highlighted in the release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants