0

私は現在、ユーザー コントロールに取り組んでおり、依存オブジェクト クラス IsEnabled のカスタム プロパティが認識されますが、FooText は認識されません。

XAML:

<ScrollViewer VerticalScrollBarVisibility="Hidden" HorizontalScrollBarVisibility="Hidden" 
                   sc:TouchScrolling.IsEnabled = "true" 
                   Grid.Row="0" Grid.Column="1">

sc:TouchScrolling 要素にさらにプロパティを設定する必要がありますが、VS はプロパティが見つからないと文句を言い続けます。

TouchScrolling 要素は Dependency Object から継承します

public class TouchScrolling : DependencyObject
    {
        public bool IsEnabled
        {
            get { return (bool)GetValue(IsEnabledProperty); }
            set { SetValue(IsEnabledProperty, value); }
        }

public static readonly DependencyProperty IsEnabledProperty =
            DependencyProperty.RegisterAttached("IsEnabled", typeof(bool), typeof(TouchScrolling), new UIPropertyMetadata(false, IsEnabledChanged));


//FooText is not recognized
  public string FooText
        {
            get { return (string)GetValue(FooTextProperty); }
            set { SetValue(FooTextProperty, value); }
        }
4

1 に答える 1

5

FooText DependencyProperty が欠落しているようです...

public static readonly DependencyProperty FooTextProperty =
            DependencyProperty.RegisterAttached("FooText", typeof(string), typeof(TouchScrolling), null);
于 2015-09-01T15:48:11.050 に答える