我需要将所有路径保存在画布中,以便轻松检索它们。我发现它适用于VisualBrush
. 当我尝试检索VisuahBrush
并放入Style
s时,它有错误:
该类型的对象System.Windows.Media.VisualBrush
不能应用于需要该类型的属性Systems.Windows.Style
。
我还能如何将所有路径保存在画布中并且仍然可以在Style
s 中检索?
任何想法都会有很大帮助,谢谢!
<VisualBrush x:Key="myVisualBrush">
<VisualBrush.Visual>
<Canvas>
<Path Fill="#FF231F20" Stretch="Fill" Width="12.69" Height="14.477" Canvas.Left="652.196" Canvas.Top="88.61" Data="F1M617.2051,52.7275C616.7281,52.4525,616.3391,52.6775,616.3391,53.2275L616.3391,66.4695C616.3391,67.0195,616.7281,67.2445,617.2051,66.9695L628.6721,60.3485C629.1481,60.0735,629.1481,59.6235,628.6721,59.3485z"/>
</Canvas>
</VisualBrush.Visual>
</VisualBrush>
<Style x:Key="myVisualStyle" BasedOn="{StaticResource myVisualBrush}" TargetType="{x:Type TextBox}">
<!-- Styles -->
</Style>