2
私はカスタムコントロールを開発しており、コントロールスタイルのセッターで2つの依存プロパティをマルチコンバータに渡したいと考えています。私のコンバータが起動しますが、値はUnsetValuesとして表示されています。RelativeSource SelfをMultiConverterにバインドする方法WPF
xmlns:custom="clr-namespace:WPFStyles.CustomControls"
xmlns:con="clr-namespace:WPFStyles.Converters">
<con:PopUpVisibilty x:Key="PopUpVisibility"/>
<Style TargetType="{x:Type custom:PopUpNotification}">
<Setter Property="MaxHeight" Value="150"/>
<Setter Property="MaxWidth" Value="250"/>
<Setter Property="Visibility">
<Setter.Value>
<MultiBinding Converter="{StaticResource PopUpVisibility}">
<Binding RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type custom:PopUpNotification}}" Path="IsOpen"/>
<Binding RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type custom:PopUpNotification}}" Path="Header"/>
</MultiBinding>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type custom:PopUpNotification}">
これらのプロパティを正しく渡す方法については、どのような助けもあります。
'RelativeSourceは、= {RelativeSource自己}'動作しませんでしたか? –
うわー、私はそこそこ馬鹿になりました、ありがとうございました。 – user3519506