XAML templates stomping on layout?

May 13, 2010 at 4:32 PM

Hi,

I'm still quite new to WPF and all that, so forgive me if the answer is 'obvious', but I have had a rummage through the themes but cannot find the answer.

My problem:

I have a view with a listbox containing a datatemplate. I have aligments set to stretch. Inside each template I have a grid, one of the cells being another listbox with an itempaneltemplate telling it to scroll horizontally. Inside the designer everything works fine - I see this sort of thing:

         A

     A1        A2

         B

     B1        B2

But when I run my app, it sems to constrain the width of the listbox, so what I see is:

    A

    A1

    A2

    B

    B1

    B2

If I set the background colour of the listbox, and even explicitly set the width to a large number, at runtime I can clearly tell thatthe listbox is being constrained to a certain width.

Any idea what the issue is?

cheers

Matt