Я создаю поведение с прикрепленными свойствами. Поведение должно привязываться к сетке:
public class InteractionsBehavior : Behavior<Grid>
{
public static readonly DependencyProperty ContainerProperty =
DependencyProperty.RegisterAttached("Container", typeof(Grid), typeof(Grid), new PropertyMetadata(null));
public static readonly DependencyProperty InteractionsProviderProperty =
DependencyProperty.RegisterAttached("InteractionsProvider", typeof(IInteractionsProvider), typeof(Grid), new PropertyMetadata(null, OnInteractionsProviderPropertyChanged));
public Grid Container
{
get { return GetValue(ContainerProperty) as Grid; }
set { this.SetValue(ContainerProperty, value); }
}
public IInteractionsProvider InteractionsProvider
{
get { return GetValue(InteractionsProviderProperty) as IInteractionsProvider; }
set { this.SetValue(InteractionsProviderProperty, value); }
}
Теперь, когда я пишу XAML, я получаю сообщение об ошибке:
<Grid Background="White" x:Name="LayoutRoot"
Behaviors:InteractionsBehavior.InteractionsProvider="{Binding InteractionsProvider}">
Ошибка 4 Свойство InteractionsProvider не существует для типа
«Сетка» в пространстве имен XML
'CLR-имена: Infrastructure.Behaviors; сборка = Infrastructure.SL'. C: \ MainPage.xaml 11 11 Controls.SL.Test
Ошибка 1 Не удалось найти присоединяемое свойство 'InteractionsProvider'
в типе
'InteractionsBehavior. C: \ MainPage.xaml 11 11 Controls.SL.Test