- darthmaule2
- Posts: 98
- Joined:
Can an attached property be defined in a different assembly than the one it is used in?
I have the following attached property which works fine if it's defined locally...
But then when I move it to an assembly "NoesisHelpers" and try to use it in my XAML by referencing that assembly, it doesn't work:
Is that expected?
Code: Select all
public static class FocusExtension
{
public static bool GetIsFocused(DependencyObject obj)
{
return (bool)obj.GetValue(IsFocusedProperty);
}
public static void SetIsFocused(DependencyObject obj, bool value)
{
obj.SetValue(IsFocusedProperty, value);
}
public static readonly DependencyProperty IsFocusedProperty =
DependencyProperty.RegisterAttached(
"IsFocused", typeof(bool), typeof(FocusExtension),
new UIPropertyMetadata(false, OnIsFocusedPropertyChanged));
private static void OnIsFocusedPropertyChanged(
DependencyObject d,
DependencyPropertyChangedEventArgs e)
{
var uie = (UIElement)d;
if ((bool)e.NewValue)
{
uie.Focus(); // Don't care about false values.
}
}
}
But then when I move it to an assembly "NoesisHelpers" and try to use it in my XAML by referencing that assembly, it doesn't work:
Code: Select all
xmlns:nh="clr-namespace:NoesisHelpers;assembly=NoesisHelpers"
...
<Grid Name="tvRootGrid" nh:FocusExtension.IsFocused="{Binding Path=IsFocused}">
Is that expected?
-
sfernandez
Site Admin
- Posts: 2984
- Joined:
Re: Can an attached property be defined in a different assembly than the one it is used in?
This is something that has been reported several times in the past (#1016).
The problem is that Noesis is not loading assemblies even if they are specified in the xaml, so for now you should load them in the domain manually before parsing a xaml that uses those assemblies.
We will provide a solution for this in a future release (initially planned for version 2.2.5).
The problem is that Noesis is not loading assemblies even if they are specified in the xaml, so for now you should load them in the domain manually before parsing a xaml that uses those assemblies.
We will provide a solution for this in a future release (initially planned for version 2.2.5).
Who is online
Users browsing this forum: No registered users and 42 guests