Raffaeu
Raffaeu

Reputation: 6973

Xamarin Android, custom control and Visual Studio designer

I have created a custom control in Xamarin using Visual Studio and C#. The Custom control works perfectly and the code is quite simple:

[DesignTimeVisible(true)]
public class CustomTextView : TextView
{
    public CustomTextView(Context context)
        :base(context)
    {

    }

    public CustomTextView(Context context, IAttributeSet attrs)
        :base(context,attrs)
    {

    }

    public CustomTextView(IntPtr javaReference, JniHandleOwnership transfer)
        :base(javaReference, transfer)
    {

    }

    public CustomTextView(Context context, IAttributeSet attrs, int defStyle)
        :base(context, attrs, defStyle)
    {

    }
}

Problem is that in design time, xamarin designer render the control in the following way, so it becomes useless for me because I cannot understand how it will look at run-time. enter image description here

Is this a limitation of the Designer for Visual Studio or can I do something about it?

Upvotes: 4

Views: 1318

Answers (1)

Pete
Pete

Reputation: 4746

As you've already noted - its a current limitation (Nov 2014) of the designer for Visual Studio for Android.

Unfortunately you will have to run on a device or emulator to see the render output.

In iOS it is now possible to render custom controls at design-time.

Upvotes: 6

Related Questions