MVVM 模式 给ListBox 的项添加图片

  • Post author:
  • Post category:其他


效果:

代码:

                        <ListBox ItemsSource="{Binding FlowModels}" SelectedItem="{Binding CurrentFlowModel}">

                            <ListBox.ItemTemplate>
                                <HierarchicalDataTemplate>
                                    <StackPanel Orientation="Horizontal">
                                        <Image Source="/SouthGIS.QualityChecker;component/Resource/Images/FlowItem.png" Height="14" Width="14" />
                                        <TextBlock  VerticalAlignment="Center" FontSize="14" Text="{Binding Name}" Margin="2,0,0,0">
                                        </TextBlock>
                                    </StackPanel>
                                </HierarchicalDataTemplate>
                            </ListBox.ItemTemplate>

                        </ListBox>



版权声明:本文为qq_33222460原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。