小编ftp*_*x32的帖子

WPF XAML静态资源样式仅适用于一个项目

所以我不明白这是怎么发生的,但我在资源字典中定义了一个按钮样式并在其中加载了该字典Windows.Resources.

但它并不适用于我想要的所有按钮,只适用于最后一个元素.

风格:

<Style TargetType="{x:Type Button}" x:Key="FolderOpenBtn">
    <Setter Property="Content">
        <Setter.Value>
            <StackPanel Orientation="Horizontal">
                <Viewbox Width="16" Height="16" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Margin="0,0,2,0">
                    <Rectangle Width="16" Height="16">
                        <Rectangle.Fill>
                            <DrawingBrush>
                                <DrawingBrush.Drawing>
                                    <DrawingGroup>
                                        <DrawingGroup.Children>
                                            <GeometryDrawing Brush="#00FFFFFF" Geometry="F1M0,0L16,0 16,16 0,16z" />
                                            <GeometryDrawing Brush="#FFF6F6F6" Geometry="F1M0,2.9688L0,11.9688C0,12.5858 0.227,13.0718 0.57,13.4038 1.14,13.9478 2,13.9688 2,13.9688L13.677,13.9688 16,8.1648 16,6.9688 15,6.9688 15,4.9688C15,3.6698,13.97,2.9688,13,2.9688L10.116,2.9688 9.116,0.9688 2,0.9688C1.005,0.9688,0,1.6658,0,2.9688" />
                                            <GeometryDrawing Brush="#FFEFEFF0" Geometry="F1M2,3L8,3 9,5 13,5 13,8 4,8 2,13z" />
                                            <GeometryDrawing Brush="#FF424242" Geometry="F1M1,3L1,12C1,12.97,1.94,12.984,1.997,12.984L2,12.984 2,3 8,3 9,5 13,5 13,8 4,8 2,13 13,13 15,8 14,8 14,5C14,4,12.764,4,13,4L9.5,4 8.5,2 2,2C2,2,1,2,1,3" />
                                        </DrawingGroup.Children>
                                    </DrawingGroup>
                                </DrawingBrush.Drawing>
                            </DrawingBrush>
                        </Rectangle.Fill>
                    </Rectangle> …
Run Code Online (Sandbox Code Playgroud)

wpf xaml resourcedictionary

2
推荐指数
1
解决办法
421
查看次数

标签 统计

resourcedictionary ×1

wpf ×1

xaml ×1