编辑 Blend 中的 DataTemplate

3

我正在使用DataTemplate将列表绑定到ListView上:

<UserControl.Resources>
        <DataTemplate x:Key="eventsListItemTemplate">
            <StackPanel Orientation="Vertical" 
                Margin="50"
                Background="#007F7F7F">
                <StackPanel Orientation="Horizontal">
                    <Image Source="/MobileCRM;component/Resources/Images/MenuIcons/icon.png"
                            Height="40"
                            Width="40"/>
                    <TextBlock Text="{Binding Title}"/>
                </StackPanel>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="Utworzono: " FontWeight="Bold"/>
                    <TextBlock Text="{Binding CreationDate}"/>
                </StackPanel>
            </StackPanel>
        </DataTemplate>
    </UserControl.Resources>

我是这样做的:

<ListBox x:Name="EventsList" ItemsSource="{Binding}"
                ItemTemplate="{StaticResource eventsListItemTemplate}" Background="#007F7F7F" SelectionChanged="EventsList_SelectionChanged" />

问题是我想使用Blend编辑此模板,而不是手动编辑xaml,但我不知道如何在Blend中打开此模板。这可能吗?

1个回答

4
以下是步骤:
  1. 在Blend中打开您的项目
  2. 在左侧找到Objects and Timeline
  3. 在项目树中找到您的ListBox
  4. 右键单击它
  5. 编辑其他模板 -> 编辑生成的项(ItemTemplate) -> 编辑当前项
  6. 按右上角的圆形按钮,设计师将显示出来

enter image description here


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接