问题描述
我有一些图像要在我的图形节点中使用,它在 png 格式下运行良好,但设计者以“.xaml”格式向我发送了图像,我如何在我的 DataTemplate 中使用它们。
<UserControl.Resources>
<DataTemplate x:Key="GraphTemplate" DataType="{x:Type localController:PocVertex}">
<StackPanel Orientation="Horizontal" Margin="5">
<Image x:Name="img" Source="C:\path\image\info.png" Width="50" Height="50" />
<TextBlock Text="[" Foreground="Red"/>
<TextBlock Text="{Binding ID,Mode=OneWay}" Foreground="Red"/>
<TextBlock Text="] " Foreground="Red"/>
<TextBlock Text="{Binding Name,Mode=OneWay}" />
</StackPanel>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding Type}" Value="Group">
<Setter TargetName="img" Property="Source"
Value="C:\path\image\image.png" />
</DataTrigger>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)