Reputation: 19
I have such class:
public class MetroButton: ContentView
{
public MetroButton ()
{
//create and filling mainGrid
this.Content = mainGrid;
}
}
This works ok. But when i renderer my ContentView (MetroButton) - content not displayed (Content disappears , there remains only the main control).
My Render:
[assembly: ExportRenderer (typeof(MetroButton), typeof(RendererToClickView))]
...
public class RendererToClickView:ViewRenderer
{
public RendererToClickView ()
{
}
}
Upvotes: 0
Views: 1563
Reputation: 1
You don't need to create a FrameRenderer
for this.
The renderer of a ContentView
is a ViewRenderer
, as can be seen in the link:
You can do something like this:
[Assembly: ExportRenderer (typeof (ImageGallery), typeof (ImageGalleryRenderer))]
Namespace MRV.AppClient.Mobile.Droid.CustomRenderers
{
Class ImageGalleryRenderer: ViewRenderer
{
Protected override void JavaFinalize ()
{
ImageService.Instance.InvalidateMemoryCache ();
Base.JavaFinalize ();
}
}
}
Upvotes: 0
Reputation: 7454
There's no ContentViewRenderer
. Try to use FrameRenderer
and just disable border drawing. That works good (tried it by myself).
public class MyFrame : Frame
{
public MyFrame()
{
Content = new Label() {
Text = "Test"
};
BackgroundColor = Color.Transparent;
OutlineColor = Color.Transparent;
}
}
[assembly: ExportRenderer (typeof (MyFrame), typeof (MyFrameRenderer))]
namespace YourAssembly.Droid
{
public class MyFrameRenderer : FrameRenderer
{
public MyFrameRenderer()
{
}
}
}
Upvotes: 1