Exemple #1
0
    /// <summary>
    ///     Creates a view.
    /// </summary>
    /// <param name="parent">The view's parent, if any.</param>
    /// <param name="name">The fully qualified name of the view being inflated.</param>
    /// <param name="context">The context that the view will be inflated in.</param>
    /// <param name="attrs">The attributes to apply to the view.</param>
    public override View OnCreateView(View parent, string name, Context context, IAttributeSet attrs)
    {
        foreach (var prefix in GetClassPrefixes())
        {
            try
            {
                return(LayoutInflater.CreateView(name, prefix, attrs));
            }
            catch
            {
                // Ignore.
            }
        }

        return(LayoutInflater.BaseOnCreateView(name, attrs));
    }
Exemple #2
0
        public global::Android.Views.View OnCreateView(string name, Context context, IAttributeSet attrs)
        {
            String viewFullName = string.Format("android.widget.{0}", name); // this is bad as it will only do the normal controls....
            var    id           = attrs.GetAttributeValue(BindingConstants.BindingNamespace, BindingConstants.IdString);

            var view = _layoutInflater.CreateView(viewFullName, null, attrs);

            if (view == null || id == null)
            {
                return(view);
            }

            var node = FindNodeWithId(_rootnode, id);

            if (node != null)
            {
                BindingFactory bf = new BindingFactory();
                foreach (var property in node.Value.Properties)
                {
                    Add(view, property.Value, node.Value);
                }
            }
            return(view);
        }