wpf Image的几种写法:
<Border Grid.Column="0" Margin="12"> <Border.Resources> <HierarchicalDataTemplate DataType="{x:Type mode:Node}" ItemsSource="{Binding Nodes}"> <StackPanel Orientation="Horizontal" Margin="0,2,0,2"> <Image Source="pack://application:,,,/ScriptConfig;Component/Images/2.png" Width="16" Height="16" /> <Image Source="/Images/2.png" Width="16" Height="16" /> <Image Source="/ScriptConfig;Component/Images/1.png" Width="16" Height="16" /> <TextBlock Text="{Binding Name}" ToolTip="{Binding Name}" Tag="{Binding}"/> </StackPanel> </HierarchicalDataTemplate> </Border.Resources> <TreeView Name="MyTreeView"> </TreeView> </Border>