Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I have a PopupBox that I want to change the icon for. Currently it defaults to DotsVertical and I would like to have it as a DotsHorizontal

I am using MaterialDesignInXAML for a WPF application. I have a PopupBox that I want to change the icon for. Currently it defaults to DotsVertical and I would like to have it as a DotsHorizontal.

I tried the following with no luck.

<materialDesign:PopupBox PlacementMode="BottomAndAlignRightEdges" StaysOpen="False">
    <materialDesign:PopupBox.Content>
        <materialDesign:PackIcon Kind="DotsHorizontal" />
    </materialDesign:PopupBox.Content>
    <StackPanel>
        <TextBlock Text="Test1" />
        <TextBlock Text="Test2" />
        <TextBlock Text="Test3" />
    </StackPanel>
</materialDesign:PopupBox>

Thanks in advance!

like image 979
David Lee Avatar asked Jun 21 '17 18:06

David Lee


2 Answers

In order to change the Icon and preserve the current style use this:

<materialDesign:PopupBox PlacementMode="BottomAndAlignRightEdges" StaysOpen="False">
     <materialDesign:PopupBox.ToggleContent>
         <materialDesign:PackIcon Kind="DotsHorizontal" 
                                Foreground="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=materialDesign:PopupBox}, Path=Foreground}"                        />
         </materialDesign:PopupBox.ToggleContent>
    <StackPanel>
        <TextBlock Text="Test1" />
        <TextBlock Text="Test2" />
        <TextBlock Text="Test3" />
    </StackPanel>
</materialDesign:PopupBox>
like image 122
Ahmed_mag Avatar answered Oct 23 '22 01:10

Ahmed_mag


Figured it out and will leave an answer here in case anyone else comes across this issue. There is a property called ToggleContent

<materialDesign:PopupBox PlacementMode="BottomAndAlignRightEdges" StaysOpen="False">
    <materialDesign:PopupBox.ToggleContent>
        <materialDesign:PackIcon Kind="DotsHorizontal" />
    </materialDesign:PopupBox.ToggleContent>
    <StackPanel>
        <TextBlock Text="Test1" />
        <TextBlock Text="Test2" />
        <TextBlock Text="Test3" />
    </StackPanel>
</materialDesign:PopupBox>
like image 20
David Lee Avatar answered Oct 23 '22 01:10

David Lee