WPF Border DesiredHeight
Posted
by Joseph Sturtevant
on Stack Overflow
See other posts from Stack Overflow
or by Joseph Sturtevant
Published on 2009-05-19T16:29:58Z
Indexed on
2010/05/28
4:31 UTC
Read the original article
Hit count: 368
The following Microsoft example code contains the following:
<Grid>
...
<Border Name="Content" ... >
...
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsExpanded" Value="True">
<Setter TargetName="ContentRow" Property="Height"
Value="{Binding ElementName=Content,Path=DesiredHeight}" />
</Trigger>
...
</ControlTemplate.Triggers>
When run, however, this code generates the following databinding error:
System.Windows.Data Error: 39 : BindingExpression path error: 'DesiredHeight' property not found on 'object' ''Border' (Name='Content')'. BindingExpression:Path=DesiredHeight; DataItem='Border' (Name='Content'); target element is 'RowDefinition' (HashCode=2034711); target property is 'Height' (type 'GridLength')
Despite this error, the code works correctly. I have looked through the documentation and DesiredHeight
does not appear to be a member of Border
. Can anyone explain where DesiredHeight
is coming from? Also, is there any way to resolve/suppress this error so my program output is clean?
© Stack Overflow or respective owner