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?