Palette - DesiredHeight

Hello,

I want to put a palette into a customized expander.

In my expander template I use this trigger:

 <ControlTemplate.Triggers>
            <Trigger Property="IsExpanded" Value="True">
              <Setter TargetName="ContentRow" Property="Height"
                      Value="{Binding ElementName=BdContent,Path=DesiredHeight}" />
            </Trigger>

But at the first opening, the size is not correct.
I must collapse and re-expand the expander to have see the palette…

Aurore

What’s the value of the ContentRow.Height the first time?

I’m guessing that the BDContent.DesiredHeight is zero because at the time the IsExpanded property becomes true the layout (e.g. the Measure) hasn’t happened yet.

There’s probably a different way to get the results that you want. However, I suspect it has nothing particularly to do with the Palette control.

you’re rigth.

 <Grid.RowDefinitions>
              <RowDefinition Height="Auto"/>
              <RowDefinition Name="ContentRow" Height="0"/>
            </Grid.RowDefinitions>

but, in another extander I put treeview, and all is ok.
the treeview have the good size…

Is there a solution to set the wanted size after the layout ?

Aurore

Another fact, to help thinking.

When I set Padding=“2” for the palette, then the expander “expands” with the right height.

Aurore

— Edit —
No, It’s not related to padding,
My expander is in a grid. If i set width ="*", the palette height is right calculated. If I set width=“auto”, desiredheigth is 0…

I just tried putting a Palette inside an Expander in a Grid column, and it worked fine. But no doubt there’s more stuff going on in your application that I don’t know about.