radimitrov / CSharpShellApp

77 stars 18 forks source link

Maui : Inheritance #347

Open equin0X35 opened 7 months ago

equin0X35 commented 7 months ago

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.

radimitrov commented 7 months ago

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

equin0X35 commented 7 months ago

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.

radimitrov commented 6 months ago

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