gpt4 book ai didi

c# - 将资源中的 WPF 几何图形添加到 GeometryGroup

转载 作者:行者123 更新时间:2023-11-30 15:23:41 25 4
gpt4 key购买 nike

所以我知道我可以做到这一点

<Path Grid.Column="0" Width="16" Height="16" Fill="{DynamicResource WindowForegroundBrush}" Stretch="Uniform">
<Path.Data>
<GeometryGroup >
<Geometry>some geometry data1</Geometry>
<Geometry>some geometry data2</Geometry>
<Geometry>some geometry data3</Geometry>
</GeometryGroup>
</Path.Data>
</Path>

但现在我想将几何数据 1、2 和 3 移动到资源字典中

---resource dictionary---

<Geometry x:Key="data1">some geometry data1</Geometry>
<Geometry x:Key="data2">some geometry data2</Geometry>
<Geometry x:Key="data2">some geometry data3</Geometry>

---resource dictionary end---

<Path Grid.Column="0" Width="16" Height="16" Fill="{DynamicResource WindowForegroundBrush}" Stretch="Uniform">
<Path.Data>
<GeometryGroup >

</GeometryGroup>
</Path.Data>
</Path>

如何将我的资源中的几何图形添加到我的几何图形组中?我可以做某种绑定(bind)或样式吗?

我更喜欢仅 xaml 解决方案,但欢迎所有解决方案。

希望这有意义。

最佳答案

这应该有效:

<Path ...>
<Path.Data>
<GeometryGroup>
<StaticResource ResourceKey="data1"/>
<StaticResource ResourceKey="data2"/>
<StaticResource ResourceKey="data3"/>
</GeometryGroup>
</Path.Data>
</Path>

关于c# - 将资源中的 WPF 几何图形添加到 GeometryGroup,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34204498/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com