I've faced a problem: Attached property doesn't work for Button's Flayout.
I have an outer button with inner button (flayout), attached property - is a ICommand type property. Outer button successfully binds to attached property BUT inner button doesn't.
Here User Control code:
<UserControl x:Class="uwp_AttachedProperty.MyUserControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:uwp_AttachedProperty"
Name="Root">
<Button Command="{Binding ElementName=Root, Path=(local:AttachedProps.CommandAdd), Mode=OneWay}">
<Button.Flyout>
<Flyout>
<!--*** DOESN'T WORK HERE***-->
<Button Command="{Binding ElementName=Root, Path=(local:AttachedProps.CommandAdd),Mode=OneWay}"/>
</Flyout>
</Button.Flyout>
</Button>
</UserControl>
Attached property code:
public sealed class AttachedProps : DependencyObject
{
public static readonly DependencyProperty CommandAddProperty = DependencyProperty.Register(
"CommandAdd",
typeof(ICommand),
typeof(AttachedProps),
new PropertyMetadata(null));
public static void SetCommandAdd(UIElement element, ICommand value) { element.SetValue(CommandAddProperty, value); }
public static ICommand GetCommandAdd(UIElement element) { return (ICommand)element.GetValue(CommandAddProperty); }
}
My case is an ICommand propery, but it doesn't work any type (double, string etc.) of attached property. Does any one faced the same problem, how can it be fixed?
(Windows 10, 1809, Build: 17763) Thanks.