views:

9

answers:

1

Hi,

I am trying to create a menu system which changes the content template for a panel AFTER the panel has been closed by a Visual State change but before the panel is re-opened (think of a slide in/out filter). I was hoping to achieve this using a combination of data triggers but am having no joy :( Some code has been ommited for brevity but my trigger setup looks as follows:

<ContentControl x:Name="contentControl" Content="{Binding SelectedThing}"
                                DataContext="{Binding}" Width="200">
                    <ContentControl.ContentTemplate>
                        <DataTemplate>
                          <ContentControl Name="cc"
                                          Content="{Binding}" />
                            <DataTemplate.Triggers>

                                <MultiDataTrigger>
                                    <MultiDataTrigger.Conditions>
                                        <Condition Value="People"
                                                   Binding="{Binding Path=Name}">
                                        </Condition>

                                        <Condition Value="0"
                                                   Binding="{Binding ElementName=contentControl,Path=Width}">
                                        </Condition>
                                    </MultiDataTrigger.Conditions>
                                    <Setter TargetName="cc"
                                            Property="ContentTemplate"
                                            Value="{StaticResource PeopleTemplate}" />
                                </MultiDataTrigger>

....

The trigger changes the template correctly when I omit the binding on contentControl width but I can't determine why (the width is animated via a change in visual state)?

Any ideas?

Thanks

A: 

Try changing Path=Width to Path=ActualWidth.

I assume the trigger is not firing because the Width property is not actually reporting that it is 0.

You can use Snoop to confirm this http://snoopwpf.codeplex.com/

Foovanadil