0

ユーザーコントロールのxamlファイルを操作しているときに別の問題が発生しました-.- '

IsCheckedボタンがチェックされている場合に別の背景色を設定するために、カスタムボタンにプロパティを実装しようとしました。

だから私はDependencyPropertyこのようなものを作成しました:

public static readonly DependencyProperty IsCheckedProperty = DependencyProperty.Register("IsChecked", typeof(bool), typeof(LeftMenuBtn));

public bool IsChecked
{
    get { return (bool)GetValue(IsCheckedProperty); }
    set { SetValue(IsCheckedProperty, value); }
}

次に、このプロパティを処理するための新しいスタイルトリガーを設定します。

<Style x:Key="ButtonEnableStates" TargetType="{x:Type Grid}">
    <Style.Triggers>
        <Trigger Property="IsChecked" Value="True">
            <Setter Property="Background" Value="{DynamicResource CheckedStateGradient}" />
        </Trigger>
    </Style.Triggers>
</Style>

Expression Blendに下線が引かれ、次のように表示Property="IsChecked"されます。

The member "IsChecked" is not recognized or is not accessible.

どうすればこの問題を解決できますか?

4

1 に答える 1

1

さて、Style'sTargetTypeGridであり、プロパティはに対して定義されておりLeftMenuBtn、そのようには機能しません。

于 2012-09-09T10:39:26.173 に答える