2 using System.Collections.Generic;
3 using System.ComponentModel;
5 using Tizen.NUI.Binding;
8 namespace Tizen.NUI.Binding.Internals
10 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
11 [EditorBrowsable(EditorBrowsableState.Never)]
12 public class NameScope : INameScope
14 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
15 [EditorBrowsable(EditorBrowsableState.Never)]
16 public static readonly BindableProperty NameScopeProperty = BindableProperty.CreateAttached("NameScope", typeof(INameScope), typeof(NameScope), default(INameScope));
18 readonly Dictionary<string, object> _names = new Dictionary<string, object>();
20 object INameScope.FindByName(string name)
22 if (_names.ContainsKey(name))
27 void INameScope.RegisterName(string name, object scopedElement)
29 if (_names.ContainsKey(name))
30 throw new ArgumentException("An element with the same key already exists in NameScope", "name");
32 _names[name] = scopedElement;
36 void INameScope.RegisterName(string name, object scopedElement, IXmlLineInfo xmlLineInfo)
40 ((INameScope)this).RegisterName(name, scopedElement);
42 catch (ArgumentException)
44 throw new XamlParseException(string.Format("An element with the name \"{0}\" already exists in this NameScope", name), xmlLineInfo);
48 void INameScope.UnregisterName(string name)
53 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
54 [EditorBrowsable(EditorBrowsableState.Never)]
55 public static INameScope GetNameScope(BindableObject bindable)
57 return (INameScope)bindable.GetValue(NameScopeProperty);
60 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
61 [EditorBrowsable(EditorBrowsableState.Never)]
62 public static void SetNameScope(BindableObject bindable, INameScope value)
64 bindable.SetValue(NameScopeProperty, value);