First, thank you JP for your reply. Your proposed solution is working, but this is not what I want. I want to set the attribute from axml the same way I set built-in atrributes. EX: <mynamespace.CustomView android:id="@+id/MyButton" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" DisplayText="Set from axml" />
In the above example, in VS I have code completion within the editor for attributes under the android namespace. How can I have the same support for my custom attribute?. -----Original Message----- From: monodroid-boun...@lists.ximian.com [mailto:monodroid-boun...@lists.ximian.com] On Behalf Of Jonathan Pryor Sent: Friday, 23 September, 2011 9:03 PM To: Discussions related to Mono for Android Subject: Re: [mono-android] Custom attribute On Sep 22, 2011, at 6:42 PM, El-Sayed Mohamed wrote: > How to set custom attribute from axml? You should be able to use the IAttributeSet methods; untested... > //Code snippet is below > > public class CustomView : ViewGroup > { > public string DisplayText > { > get; > set; > } > > public CustomView(Context context, IAttributeSet attrs) : > base(context, attrs) > { DisplayText = attrs.GetAttributeValue (null, "DisplayText"); - Jon _______________________________________________ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid _______________________________________________ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid