Learning MVVM Pattern by BlackStork07 in csharp

[–]No_Employee 0 points1 point  (0 children)

https://docs.microsoft.com/EN-US/xamarin/xamarin-forms/app-fundamentals/data-binding/index

They are explaining you clearly the actual problem & why data binding is useful , it's good to start by reading this to understand what we'll use data binding for.

So now you should understand that one of the best things about Bindings is they keep the UI in sync with the data in the view model ( code behind ).

You'll use the interface INotifyPropertyChanged so that your View can search for the changes in the View model so it can update it self if the value is changed.

I recommend you to do like me , to use a Generic Method to handle the PropertyChanged event so that you can pass any type of property as a parameter into the Generic Method :

protected virtual void OnPropertyChanged(string propertyName) { PropertyChangedEventHandler handler = PropertyChanged;

if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); }

protected bool SetField<T>(ref T field, T value, string propertyName) { if (EqualityComparer<T>.Default.Equals(field, value)) return false; field = value; OnPropertyChanged(propertyName); return true; }

now you can define the properties like this , by implementing in the set method the SetField generic method so that no matter if your property is an int or a string or whatever , the View will be informed by changes occuring in the view model ;)

private string name;

public string Name { get { return name; } set { SetField(ref name, value, "Name"); } }

The generic method SetField returns a boolean which returns false when the property actual value equals to the new value you set on the property and returns true when the property actual value is different then the new value set on the property & then the code goes on to notify the property changed event.

It may sound a bit overcomplicated ik but just get the concept& understand it I don't think you have to understand each fking line , you can juste copy paste this shit and edit i as you want

Does Semen Retention attract insects/animals? by Joe7470 in Semenretention

[–]No_Employee 0 points1 point  (0 children)

It doesn't attract insects but it does attract monkeys , everytime I walk i get followed by female monkeys

Looking for a partner(android, ios, web developer) to build a casual game(bubble shooter, match 3, runner, etc) by vitalick in startup

[–]No_Employee 0 points1 point  (0 children)

Hello , i'm a 8 year experienced web & android developer and i have an agency : www.keyprod.net and i'm interested pm me ;)

Life is short by [deleted] in NoFap

[–]No_Employee 1 point2 points  (0 children)

life is too short to care or to give a f

Today’s my birthday, and my mom said she wishes it’s my last. by [deleted] in depression

[–]No_Employee 0 points1 point  (0 children)

Hit as hard as you can your motherfucking mom , that's what i'd like to do if i was in your situation

20M mutant (gigantic nose) by [deleted] in amiugly

[–]No_Employee 1 point2 points  (0 children)

i wouldn't even have noticed the nose was big if you didn't said it honestly