CSharpShellApp icon indicating copy to clipboard operation
CSharpShellApp copied to clipboard

Maui : Inheritance

Open noubiex opened this issue 2 years ago • 3 comments

I love exploring new things but suddenly i got stopped by this issue. When i try subclassing a maui element it gives me this exception : NO JAVA PEER TYPE FOUND.

/**
 * Just to demonstarte the issue
 * using TextView as a sample.
 */
public class TextView : View 
{
    public static readonly BindableProperty TextProperty = BindableProperty.Create(nameof(Text), typeof(string), typeof(TextView), default(string));
    public string Text => (string)GetValue(TextProperty);
}

/**
 * Subclassing maui's textView
 */
public class NativeTextView : MauiTextView;

/**
 * Handler for TextView and NativeTextView.
 */
public class TextViewHandler : ViewHandler<TextView, NativeTextView>;

What ever i do, it always gives me this exception, is this a bug?? or the app doesn't support this kind of inheritance.

noubiex avatar Nov 26 '23 00:11 noubiex

It doesn't support it and there is guarantee it will (ex. #121 & #273 )

radimitrov avatar Nov 28 '23 12:11 radimitrov

I really feel like i'm not allowed to do something like this because the app doesnt support it. But, it is nice to hear that there could be a chance of supporting.

noubiex avatar Dec 02 '23 02:12 noubiex

I do have plans to try implementing this. However it must be after I've finished other important stuff since this is a time consuming experiment that has a good chance of failing

radimitrov avatar Dec 03 '23 09:12 radimitrov