views:

30

answers:

2

I have an ItemsControl that has a fairly complex ItemTemplate which allows the user to edit an Order. Unfortunately the design surface in Visual Studio does not show the ItemTemplate so I don't get an instant feedback of the changes I make. Is there a way to visualize the ItemTemplate in Visual Studio? Here's the structure of my control:

<ItemsControl ItemsSource="{Binding Orders, Mode=TwoWay}">
    <ItemsControl.ItemTemplate>
        <DataTemplate>
            <Grid>
                <!-- Fairly complex form here -->
            </Grid>
        </DataTemplate>
    </ItemsControl.ItemTemplate>
</ItemsControl>
+3  A: 

In the past I've just copied the contents of the DataTemplate into a new WPFControl. Sometimes I've had to use some dummy data to view it properly, but for the most part it works fine.

Rachel
Reasonable approach! Thanks.
Naresh
+2  A: 

If you have complicated UI, it might be better to refactor it out into a UserControl, which you can then visualise normally in Visual Studio.

Alternatively, I believe that Expression Blend (if you have access to that) allows you to visualise the DataTemplate directly

Steve Greatrex
The problem with Expression Blend is that once you use it, you will never want to write XAML any other way. It's a wonderful tool.
Tergiver
Good suggestion on refactoring out as a UserControl. As for Expression Blend, I could not figure out how to visualize the ItemTemplate - but I am not an experienced Blend user.
Naresh