- ai_enabled
- Posts: 231
- Joined:
- Contact:
[RESOLVED] AttachedProperties [Unity]
I'm looking for a way to define attached property in NoesisGUI 1.1.2 Unity3D. In WPF is code like this:
I've tried to register attached property in NoesisGUI as DependencyProperty (as described in docs), and it seems to work except I can't find the way to add callback handler to handle event when this property was attached to FrameworkElement. Is there any way to achieve it in the NoesisGUI?
Code: Select all
public class TestClass: DependencyObject
{
public static readonly DependencyProperty PropNameProperty =
DependencyProperty.RegisterAttached(
"PropName",
typeof(object),
typeof(TestClass),
new FrameworkPropertyMetadata(null, PropertyChangedCallback));
private static void PropertyChangedCallback(
DependencyObject dependencyObject,
DependencyPropertyChangedEventArgs args)
{
FrameworkElement fe = dependencyObject as FrameworkElement;
if (fe == null) return;
// property was assigned/removed from FrameworkElement
// so we can do something useful here
}
public static object GetPropName(UIElement element)
{
return element.GetValue(PropNameProperty);
}
public static void SetPropName(UIElement element, object value)
{
element.SetValue(PropNameProperty, value);
}
}
Last edited by ai_enabled on 12 Jan 2016, 12:30, edited 1 time in total.
AtomicTorch Studio Pte. Ltd. http://atomictorch.com
-
sfernandez
Site Admin
- Posts: 3184
- Joined:
Re: AttachedProperties [Unity]
Hi,
The PropertyChangedCallback cannot be specified in Unity yet. We have an open ticket regarding this issue and will be solved in a future version.
Sorry for the inconvenience.
The PropertyChangedCallback cannot be specified in Unity yet. We have an open ticket regarding this issue and will be solved in a future version.
Sorry for the inconvenience.
- ai_enabled
- Posts: 231
- Joined:
- Contact:
Re: AttachedProperties [Unity]
Nice to hear. It's very important for our project - we're trying to implement custom tooltips system (and we're already complete it in WPF), but without this feature it's not possible.We have an open ticket regarding this issue and will be solved in a future version.
AtomicTorch Studio Pte. Ltd. http://atomictorch.com