1
<StackPanel Name="mypanel">
   <ScrollViewer Height="{Binding ElementName=mypanel, Path=ActualHeight}">

が必要ですHeight = mypanel.ActualHeight-60

どうすればいいですか?

編集:

<StackPanel Name="mypanel">
    <ContentControl Content="{Binding HeaderPart}" /> <= here must be Expander
    <ScrollViewer Height="{Binding ElementName=mypanel, Path=ActualHeight, Converter={StaticResource HeightConverter}}" >
        <StackPanel>
        </StackPanel>
    </ScrollViewer>

がない場合Expander、すべてが機能しています。Expanderが、mypanel.ActualHeight、の場合HeightAdjustmentConverter = 0

どうしたの?

4

1 に答える 1

1

を受け取り、そのマイナス 60 の新しい値を返すIValueConverterを作成する必要があります。ActualHeight

何かのようなもの:

[ValueConversion(typeof(double), typeof(double))]
public class HeightAdjustmentConverter: IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        double original = (double)value;
        return double - 60;
    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        double adjusted = (double)value;
        return adjusted + 60;
    }
}
于 2010-08-16T11:10:04.557 に答える