图像蒙版不适用于MaterialDesign:PopupBox.Toggle WPF

时间:2019-02-21 03:37:00

标签: c# wpf

我有一个弹出框(来自WPF的Material Design工具包),并且我在popupbox.togglecontent内有一个带有图像蒙版的网格。当网格超出切换内容时,它将正常工作,但是当在网格内时,则不会显示图像。这是我的XAML代码:

<materialDesign:PopupBox StaysOpen="False" Margin="0,0,0,0">
                <materialDesign:PopupBox.ToggleContent>
                    <!--THIS PART WORKS OUT OF ToggleContent PERFECLTY-->
                    <Grid Margin="0,0,0,10">
                        <Border x:Name="borderImage" Canvas.Left="55"
                        Canvas.Top="30"
                        Width="40"
                        Height="Auto"
                        Margin="12,12,8,0"
                        VerticalAlignment="Top"
                        BorderBrush="#282828"
                        BorderThickness=".5"
                        CornerRadius="50">
                            <Border.Effect>
                                <DropShadowEffect BlurRadius="5"
                          Opacity=".5"
                          ShadowDepth="3" />
                            </Border.Effect>
                            <Border Name="ReceiverColor"
                            BorderBrush="#7A2932"
                            BorderThickness="2.5"
                            CornerRadius="50">
                                <Grid>
                                    <Border Name="Mask"
                                    Background="#282828"
                                    BorderBrush="#282828"
                                    BorderThickness=".5"
                                    CornerRadius="50">
                                    </Border>
                                    <StackPanel>
                                        <Image x:Name="imgUser" Width="{Binding ActualWidth, ElementName=borderImage}" Height="30" Source="/Resources/Images/teste.png"/>
                                        <StackPanel.OpacityMask>
                                            <VisualBrush Visual="{Binding ElementName=Mask}" />
                                        </StackPanel.OpacityMask>
                                    </StackPanel>
                                </Grid>
                            </Border>
                        </Border>
                    </Grid>
                    <!--END OF COMMENT-->
                </materialDesign:PopupBox.ToggleContent>
                <StackPanel x:Name="teste" Width="150">
                    <Button Content="Conta"/>
                    <Separator/>
                    <Button Content="Logout"/>
                </StackPanel>
            </materialDesign:PopupBox>

谁能告诉我为什么面具没有显示图像?

0 个答案:

没有答案