Skip to content

How to add button in listbox in material design in XAML toolkit? #3093

Closed Answered by nicolaihenriksen
VahidEra asked this question in Q&A
Discussion options

You must be logged in to vote

@VahidEra This question is not directly related to the MDIX toolkit, but it is a good question, and one that really highlights the flexibility that WPF provides. In WPF, all elements are associated with a template which dictates how the control should be rendered.

So what you want to do here is to change the way a ListBoxItem is rendered, this can be done by overriding the ListBox.ItemContainerStyle and modify it to fit your needs. The code below does so by inheriting from the normal MaterialDesignListBoxItem and then overriding the ContentTemplate on that style to take control of the rendering of the actual content (this means the row highlight and other stuff is retained). In the Conten…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@VahidEra
Comment options

Answer selected by VahidEra
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants