Expression Blend: Template loops (no problems in Cider, though)

In one of my side-projects, I wanted to create a kind of lightweight treeview, as simple as possible: An item can contain a list of items; each item is simple represented by a string. In OO design, it's rather easy: You crate a DataItem class, which contains a Description and a collection of DataItems (children).

Wanting to take advantage of ControlTemplates and DataTemplates, I thought I would create the following structure in WPF:

- Window
    - Grid
        - Control
            - Template "MyControlTemplate" (ControlTemplate)
                - TextBlock "Description"
                - ItemsControl
                    - ItemTemplate "MyDataTemplate" (DataTemplate)
                        - Control
                            - ControlTemplate "MyControlTemplate"

Note that there is no infinite recursion: I have a finite number of items; if the collection of children is empty, no DataTemplate should be instantiated.

In order to make the design easier, and as I use to do nowadays in WPF, I use the Model-ViewModel-View pattern which I described (with other names, but still) here. I then found out that strangely enough, Expression Blend is unable to display the structure, even though Cider (in Orcas September CTP) doesn't have any problems with it.

I submitted this case to the Blend team. I met them last time I was in Redmond, and they're great guys, who do listen to their customers!

A test project where this problem can be visualized is available on my site.

TemplateLoop in Cider (successful)
TemplateLoop in Cider (successful)
TemplateLoop in Blend (fail)
TemplateLoop in Blend (fail)
Print | posted on Sunday, November 04, 2007 2:27 AM

Feedback

No comments posted yet.
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: