Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid [IgnoredProp] attribute for the readonly property #51

Closed
KannanKrish opened this issue Aug 17, 2023 · 3 comments
Closed

Avoid [IgnoredProp] attribute for the readonly property #51

KannanKrish opened this issue Aug 17, 2023 · 3 comments

Comments

@KannanKrish
Copy link

Code

[AllBindableProps]
public partial class AvatarView : ContentView
{
     private readonly Frame controlFrame;
}

Should not generate code. but the generator generates the following code

public  static readonly BindableProperty ControlFrameProperty = BindableProperty.Create(
		  nameof(ControlFrame),
		  typeof(Frame),
		  typeof(AvatarView),
		  default,
		  propertyChanged: (bindable, oldValue, newValue) =>
						  ((AvatarView)bindable).ControlFrame = (Frame)newValue
	  );

public  Frame ControlFrame
{
  get => controlFrame;
  set 
  { 
	  OnPropertyChanging(nameof(ControlFrame));

	  controlFrame = value;
	  SetValue(AvatarView.ControlFrameProperty, controlFrame);

	  OnPropertyChanged(nameof(ControlFrame));
  }
}

This allows to use the IgnoredProp attribute

@KafkaWannaFly
Copy link
Owner

Do you mean that you don't want to generate code on readonly fields?

@KannanKrish
Copy link
Author

KannanKrish commented Aug 18, 2023

Yes Exactly.

readonly fields can't be the Bindable property. Once we change this, we can avoid IgnoredProp attribute.

KafkaWannaFly pushed a commit that referenced this issue Aug 19, 2023
KafkaWannaFly pushed a commit that referenced this issue Aug 19, 2023
@KafkaWannaFly
Copy link
Owner

Please update to the latest version to enjoy the fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants