1
マルチバインドを再利用し、this solutionを使用しようとしましたが、セッタープロパティからIsEnabledに到達できないようです。アプリケーションリソースで定義されたマルチバインディングにアクセスする方法
は、だから私は、このアプローチを試してみましたが、無葉巻:
App.xaml
<Application x:Class="Test.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:model="clr-namespace:Test.MODEL"
StartupUri="MainWindow.xaml">
<Application.Resources>
<view:BooleanConverter x:Key="BooleanConverter" />
<view:BooleanMultiConverter x:Key="BooleanMultiConverter" />
<MultiBinding x:Key="OnOffBinding" Converter="{StaticResource BooleanMultiConverter}" ConverterParameter="OR">
<Binding Path="model:CustomerIsDefined" Converter="{StaticResource BooleanConverter}" />
<Binding Path="model:CustomerIsConfirmed" Converter="{StaticResource BooleanConverter}" />
</MultiBinding>
</Application.Resources>
MainWindow.xaml>これらの二つの試みはコンパイルされません。
<TextBox IsEnabled="{StaticResource OnOffBinding}"/>
<TextBox IsEnabled="{MultiBinding {StaticResource OnOffBinding}}" />
何か案は?
編集: Funcsの回答を受け入れると、これは既にリンクされたスレッドで回答されているようです。申し訳ありません..
Style = "{StaticResource ControlEnabler}"はキャストを無効にします。私が書いたように、私はすでにこのアプローチを試みました。あなたがローカルレベルでこれをやろうとすると、SettersプロパティからIsEnabledにアクセスできないことがわかります – noontz
@noontzうまくいきました。 MultiBindingはブール値を返す必要があります。 – Funk
努力をいただきありがとうございます。 BooleanMultiConverterのコードを教えてください。私はブール値を返しますが、あなたのapp.xamlスニペットをコンパイルできません:x:Key = "OnOffBinding"の部分にエラーMC3032があります – noontz