我有一個網格,我希望一個彈出窗口顯示在一個常數的關係,無論彈出窗口和網格的大小。我用一個轉換器,它這裏是代碼如何綁定到彈出ActualHeight
< Grid Name=YParamTextBlock>
<TextBlock HorizontalAlignment="Center"/>
<Popup PlacementTarget="{Binding ElementName=YParamTextBlock}} Placement="Center">
<Popup.VerticalOffSet>
<MultiBinding Mode="OneWay" Converter="{StaticResource OffsetConverter} NotifyOnTargetChanged="True">
<Binding Mode="OneWay" ElementName="YParamTextBlock" Path="ActualHeight" NotifyOnTargetUpdated="True"/>
<Binding Mode="OneWay" RelativeSource={RelativeSource Self} Path="ActualHeight" NotifyOnTargetChanged="True"/>
</MultiBinding>
</Popup.VerticalOffset>
</Popup>
<Grid>
的問題是,實際高度是兩個控件0.0首先創建時,所以我加了NotifyOnTargetChanged,以解決它。 現在,由於某種原因,NotifyOnTargetChanged修復了Grid的ActualHeight重新綁定,但Popup仍然爲0.0。無論如何要通知彈出的實際高度已更改?或者對於這個問題的其他解決方案?
對不起,我把它寫在我的智能手機上。如果有人會編輯我的問題,以正確顯示代碼,我將不勝感激。 – gilmishal