User avatar
ai_enabled
Topic Author
Posts: 231
Joined: 18 Jul 2013, 05:28
Contact:

[RESOLVED] AttachedProperties [Unity]

05 Dec 2013, 09:00

I'm looking for a way to define attached property in NoesisGUI 1.1.2 Unity3D. In WPF is code like this:
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);
		}
}
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?
Last edited by ai_enabled on 12 Jan 2016, 12:30, edited 1 time in total.
AtomicTorch Studio Pte. Ltd. http://atomictorch.com
 
User avatar
sfernandez
Site Admin
Posts: 3184
Joined: 22 Dec 2011, 19:20

Re: AttachedProperties [Unity]

05 Dec 2013, 17:27

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.
 
User avatar
ai_enabled
Topic Author
Posts: 231
Joined: 18 Jul 2013, 05:28
Contact:

Re: AttachedProperties [Unity]

05 Dec 2013, 17:36

We have an open ticket regarding this issue and will be solved in a future version.
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.
AtomicTorch Studio Pte. Ltd. http://atomictorch.com

Who is online

Users browsing this forum: Bing [Bot], LastSynapse, Semrush [Bot] and 3 guests