Andrzej Gis
Andrzej Gis

Reputation: 14316

Edit DataTemplate in Blend

I'm binding a list to a ListView using a DataTemplate:

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

And I do it like this:

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

The problem is I'd like to edit this template using Blend instead of manually editing xaml, but I have no idea how to open this template in Blend. Is it possible?

Upvotes: 3

Views: 440

Answers (1)

Igor Ralic
Igor Ralic

Reputation: 15006

Here are the steps:

  1. Open your project in Blend
  2. On the left side find Objects and Timeline
  3. Find your ListBox in the tree of items
  4. Right click on it
  5. Edit Additional Templates -> Edit Generated Items (ItemTemplate) -> Edit Current
  6. Press the circled button in the right top corner and the designer will be shown

enter image description here

Upvotes: 4

Related Questions