[英]Wpf Styling Viewbox Path
I have an user control like this. 我有这样的用户控件。
Button
Viewbox
ContentPresenter
Grid
Path
I need to change Button.Viewbox.Grid.Path.Fill
color. 我需要更改
Button.Viewbox.Grid.Path.Fill
颜色。
Is there any way to do this? 有什么办法吗?
My Style.xaml: 我的Style.xaml:
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style x:Key="PathStyle" TargetType="{x:Type Viewbox}">
<!-- ?????????????????? -->
</Style>
I tried this 我试过了
<Button>
<Viewbox Width="18" Height="18" Style="{DynamicResource PathStyle}">
<ContentPresenter Content="{Binding Converter={StaticResource uriToUIElementConverter}, ConverterParameter=Images/New.xaml}"></ContentPresenter>
</Viewbox>
</Button>
New.Xaml 新的
<Grid xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="newDocument" Fill="#FF000000" Stretch="Fill">
<Path.Data>
<PathGeometry FillRule="Nonzero" Figures="M43,30L50.75,30 43,22.25 43,30z M52,34L39,34 39,21 24,21 24,45 20,45 20,17 43.25,17 56,29.75 56,59 34,59 34,55 52,55 52,34z M28,38L33,38 33,46 41,46 41,51 33,51 33,59 28,59 28,51 20,51 20,46 28,46 28,38z M20,59L20,52 24,52 24,55 27,55 27,59 20,59z" />
</Path.Data>
</Path>
</Grid>
Uhm, 嗯
<Path Fill="Red" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="newDocument" Stretch="Fill">
<Path.Data>
<PathGeometry FillRule="Nonzero" Figures="M43,30L50.75,30 43,22.25 43,30z M52,34L39,34 39,21 24,21 24,45 20,45 20,17 43.25,17 56,29.75 56,59 34,59 34,55 52,55 52,34z M28,38L33,38 33,46 41,46 41,51 33,51 33,59 28,59 28,51 20,51 20,46 28,46 28,38z M20,59L20,52 24,52 24,55 27,55 27,59 20,59z" />
</Path.Data>
</Path>
? ?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.