WPF图片引用的几种写法

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>
View Code

 

posted @ 2017-07-18 14:49  jumahe  阅读(648)  评论(0编辑  收藏  举报