I'm currently working on a user control and stuck with the custom properties of the dependency object class IsEnabled gets recognized but not FooText
XAML:
<ScrollViewer VerticalScrollBarVisibility="Hidden" HorizontalScrollBarVisibility="Hidden"
sc:TouchScrolling.IsEnabled = "true"
Grid.Row="0" Grid.Column="1">
I need to set more properties on the sc:TouchScrolling element, but VS keeps complaining that it can't find the property.
TouchScrolling element inherits from 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); }
}
You seem to be missing the FooText DependencyProperty...
public static readonly DependencyProperty FooTextProperty =
DependencyProperty.RegisterAttached("FooText", typeof(string), typeof(TouchScrolling), null);