{"id":1645,"date":"2020-10-29T18:03:12","date_gmt":"2020-10-29T18:03:12","guid":{"rendered":"https:\/\/serkanseker.com\/?p=1645"},"modified":"2021-02-22T07:41:59","modified_gmt":"2021-02-22T07:41:59","slug":"xamarin-forms-mvvm-pattern","status":"publish","type":"post","link":"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/","title":{"rendered":"Xamarin.Forms MVVM Pattern"},"content":{"rendered":"\n<p>When developing applications in <a href=\"https:\/\/dotnet.microsoft.com\/apps\/xamarin\" target=\"_blank\" rel=\"noreferrer noopener\">Xamarin<\/a>.Forms, the user interface is generally developed in XAML and interaction is provided with background codes. However, this causes maintenance and testing issues when the application grows and becomes complex. You can avoid these problems by setting up projects with the MVVM model.<\/p>\n\n\n\n<p>MVVM (Model &#8211; View &#8211; ViewModel) model separates the business and presentation layers of an application from the user interface. This separation helps make testing, maintenance, and development of an application easier. Naturally, it enables designers and developers to collaborate more harmoniously.<\/p>\n\n\n\n<div class=\"schema-how-to wp-block-yoast-how-to-block\"><p class=\"schema-how-to-description\"><\/p> <ol class=\"schema-how-to-steps\"><li class=\"schema-how-to-step\" id=\"how-to-step-1604079051470\"><strong class=\"schema-how-to-step-name\"><a href=\"#mvvm-design-pattern\">MVVM Design Pattern<\/a><\/strong> <p class=\"schema-how-to-step-text\"><\/p> <\/li><li class=\"schema-how-to-step\" id=\"how-to-step-1604079063418\"><strong class=\"schema-how-to-step-name\"><a href=\"#mvvm-model-viewmodel-view\">MVVM (Model-View-ViewModel)<\/a><\/strong> <p class=\"schema-how-to-step-text\"><\/p> <\/li><li class=\"schema-how-to-step\" id=\"how-to-step-1604079064630\"><strong class=\"schema-how-to-step-name\"><a href=\"#binding-viewmodel-to-view\">Binding ViewModel to View<\/a><\/strong> <p class=\"schema-how-to-step-text\"><\/p> <\/li><li class=\"schema-how-to-step\" id=\"how-to-step-1604079065131\"><strong class=\"schema-how-to-step-name\"><a href=\"#updating-view-response-changes-mvvm\">Updating View in Response to Changes in MVVM<\/a><\/strong> <p class=\"schema-how-to-step-text\"><\/p> <\/li><li class=\"schema-how-to-step\" id=\"how-to-step-1604079065295\"><strong class=\"schema-how-to-step-name\"><a href=\"#implementing-commands\">Implementing Commands<\/a><\/strong> <p class=\"schema-how-to-step-text\"><\/p> <\/li><li class=\"schema-how-to-step\" id=\"how-to-step-1604079065429\"><strong class=\"schema-how-to-step-name\"><a href=\"#advantage-mvvm-pattern\">Advantages of MVVM Pattern<\/a><\/strong> <p class=\"schema-how-to-step-text\"><\/p> <\/li><li class=\"schema-how-to-step\" id=\"how-to-step-1604079108076\"><strong class=\"schema-how-to-step-name\"><a href=\"#disadvantage-mvvm-pattern\">Disadvantages of MVVM Pattern<\/a><\/strong> <p class=\"schema-how-to-step-text\"><\/p> <\/li><li class=\"schema-how-to-step\" id=\"how-to-step-1604079119054\"><strong class=\"schema-how-to-step-name\"><a href=\"#conclusion\">Conclusion<\/a><\/strong> <p class=\"schema-how-to-step-text\"><\/p> <\/li><\/ol><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"mvvm-design-pattern\">MVVM Design Pattern<\/h2>\n\n\n\n<p>First of all, it is important to understand the components&#8217; tasks and how they interact with each other. The MVVM pattern consists of the basic components of Model, View and ViewModel. These layers are separate from each other. The Model layer doesn&#8217;t know the ViewModel layer and the ViewModel layer doesn&#8217;t know the View layer. Thus, it is possible to develop the components independently.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/serkanseker.com\/wp-content\/uploads\/2020\/10\/MVVM-Pattern-in-Xamarin.Forms-Apps.jpg\" alt=\"MVVM Pattern in Xamarin.Forms Apps\" class=\"wp-image-1664\"\/><figcaption>MVVM Pattern in Xamarin.Forms Apps<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"mvvm-model-viewmodel-view\">MVVM (Model-View-ViewModel)<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Model<\/h3>\n\n\n\n<p>Model, in short, are non-visual classes that contain data that will be used in the application.The model class is independent of the ViewModel class. Examples are Data transfer objects (DTOs), Plain Old CLR Objects (POCOs).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">ViewModel<\/h3>\n\n\n\n<p>It binds data between View and Model, executes commands and reports changes, that is, it acts as a bridge. ViewModel knows the model layer but not the View layer. ViewModel makes use of the PropertyChanged event when connecting data and the ObservableCollection class for collections.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">View<\/h3>\n\n\n\n<p>View is the layer on which the image of the application is presented, that is, the UI elements are located. Ideally, build the views with XAML. Thus, you will apply the Separation of Concerns principle. In Xamarin.Forms applications, the View is usually derived from the Page or ContentView class. To interact with a view item in view, such as click, selection, define a command method in the ViewModel class and connect it to the view component. I will illustrate this below with a simple example later.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"binding-viewmodel-to-view\">Binding ViewModel to View<\/h2>\n\n\n\n<p>The ViewModel class is usually attached to the View layer declaratively and programmatically.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Binding Declaratively<\/h3>\n\n\n\n<p>Knowingly connecting is a simpler method. It is a declarative binding of the view model to the BindingContext of the view in XAML.<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-markup\">&lt;ContentPage ... xmlns:local=&quot;clr-namespace:eShop&quot;&gt;  \n    &lt;ContentPage.BindingContext&gt;  \n        &lt;local:LoginViewModel \/&gt;  \n    &lt;\/ContentPage.BindingContext&gt;  \n&lt;\/ContentPage&gt;<\/code><\/pre>\n\n\n\n<p>Its simplicity is an advantage, but it connects with the default constructor of the ViewModel class, meaning it has no parameters.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Binding Programmatically<\/h3>\n\n\n\n<p>The ViewModel class connects with the BindingContext property in the xaml.cs class of the view. With this method, parameterized constructor methods of ViewModel class can be connected.<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-csharp\">public LoginView()  \n{  \n    InitializeComponent();  \n    BindingContext = new LoginViewModel(navigationService);  \n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"updating-view-response-changes-mvvm\">Updating View in Response to Changes in MVVM<\/h2>\n\n\n\n<p>ViewModel and Model classes accessible by View must implement the INotifyPropertyChanged interface. This way, when the basic properties of the ViewModel or Model class change, the components in the view change. It always triggers the PropertyChanged event when the value of a property changes and its values are used by other properties. Also, never trigger the PropertyChanged event if the value of a property doesn&#8217;t change.<\/p>\n\n\n\n<p>In the example below, BaseViewModel is implementing the INotifyPropertyChanged interface. The OnPropertyChanged method checks and reports changes.<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-csharp\">    public class BaseViewModel : INotifyPropertyChanged\n    {\n\n        public event PropertyChangedEventHandler PropertyChanged;\n\n        public void OnPropertyChanged([CallerMemberName] string name = &quot;&quot;)\n        {\n            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));\n        }\n\n    }<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"implementing-commands\">Implementing Commands<\/h2>\n\n\n\n<p>Commands are examples of objects that implement the ICommand interface. Use commands to interact with UI elements in Xamarin.Forms. To add commands to the view, add command methods in the ViewModel class, then bind these methods to the view component.<\/p>\n\n\n\n<p>Let&#8217;s show it with an example.<\/p>\n\n\n\n<p>First, we defined a command method named ShareCommand in ViewModel class. This method will be called when clicking the PancakeView component in the view.<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-csharp\">public ICommand ShareCommand =&gt; new Command(() =&gt; Share.RequestAsync(selectedTrack.PreviewUrl));<\/code><\/pre>\n\n\n\n<p>Then I connected the command method using the TapGestureRecognizer feature of the PancakeView component. So when I click on PancakeView, the ShareCommand method will work.<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-markup\">&lt;pv:PancakeView&gt;\n    &lt;pv:PancakeView.GestureRecognizers&gt;\n        &lt;TapGestureRecognizer Command=&quot;{Binding ShareCommand}&quot;\/&gt;\n    &lt;\/pv:PancakeView.GestureRecognizers&gt;\n    &lt;Image Source=&quot;share.png&quot; HeightRequest=&quot;40&quot; WidthRequest=&quot;40&quot;\/&gt;\n&lt;\/pv:PancakeView&gt;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"advantage-mvvm-pattern\">Advantages of MVVM Pattern<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>Separation of Concerns (SoC): MVVM model positions layers independently from each other. A new model added does not break the project structure.<\/li><li>MVVM allows development of separate code on each layer. Thus, Front-end and back-end developers can collaborate easily.<\/li><li>Easy to maintain. For example, a change you make to the Model class does not affect the view.<\/li><li>Increases testability. Since the visual interface and code are separate from each other, it is easier to test.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"disadvantage-mvvm-pattern\">Disadvantages of MVVM Pattern<\/h2>\n\n\n\n<p>Contrary to its advantages, the MVVM model also has some disadvantages.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>The amount of code increases. Naturally, connecting layers increases the amount of code.<\/li><li>Memory consumption increases.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"conclusion\">Conclusion<\/h2>\n\n\n\n<p>In summary, we examined the structure and layers of the MVVM model, then connecting layers, and finally the advantages and disadvantages. Consequently, using the MVVM model in Xamarin.Forms projects facilitates maintenance, testing and sustainability. Moreover, it greatly reduces the code complexity. This is what every developer wants.<\/p>\n\n\n\n<p>If you\u2019re still not sure what to do, or if you got any errors, then I suggest you use the comment section below and let me know! I am here to help!<\/p>\n\n\n\n<p><strong>Also, share this blog post on social media and help more people learn.<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Related Links<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/serkanseker.com\/xamarin-using-sqlite-mvvm-structure\/\" target=\"_blank\" rel=\"noreferrer noopener\">Using SQLite With MVVM in Xamarin<\/a><\/li><li><a href=\"https:\/\/serkanseker.com\/xamarin-forms-listview-grouping\/\" target=\"_blank\" rel=\"noreferrer noopener\">Xamarin.Forms ListView Grouping<\/a><\/li><li><a href=\"https:\/\/serkanseker.com\/xamarin-forms-visualize-your-data-with-sfchart\/\" target=\"_blank\" rel=\"noreferrer noopener\">Visualize Your Data With SfChart in Xamarin.Forms<\/a><\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>MVVM (Model &#8211; View &#8211; ViewModel) model separates the business and presentation layers of an application from the user interface. This separation helps make testing, maintenance, and development of an application easier. Naturally, it enables designers and developers to collaborate more harmoniously.<\/p>\n","protected":false},"author":1,"featured_media":216,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","footnotes":""},"categories":[21,39],"tags":[42,4,5],"class_list":["post-1645","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-xamarin","category-xamarin-forms","tag-mvvm","tag-xamarin","tag-xamarin-forms"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Xamarin.Forms MVVM Pattern - Serkan Seker TR<\/title>\n<meta name=\"robots\" content=\"noindex, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Xamarin.Forms MVVM Pattern - Serkan Seker TR\" \/>\n<meta property=\"og:description\" content=\"MVVM (Model - View - ViewModel) model separates the business and presentation layers of an application from the user interface. This separation helps make testing, maintenance, and development of an application easier. Naturally, it enables designers and developers to collaborate more harmoniously.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/\" \/>\n<meta property=\"og:site_name\" content=\"Serkan Seker TR\" \/>\n<meta property=\"article:published_time\" content=\"2020-10-29T18:03:12+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-02-22T07:41:59+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/serkanseker.com\/tr\/wp-content\/uploads\/2020\/12\/Xamarin.Forms-MVVM-Pattern.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1\" \/>\n\t<meta property=\"og:image:height\" content=\"1\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"serkanadmin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"serkanadmin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/\"},\"author\":{\"name\":\"serkanadmin\",\"@id\":\"https:\/\/serkanseker.com\/tr\/#\/schema\/person\/841fcc69b248e08e52c4190963caeaf5\"},\"headline\":\"Xamarin.Forms MVVM Pattern\",\"datePublished\":\"2020-10-29T18:03:12+00:00\",\"dateModified\":\"2021-02-22T07:41:59+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/\"},\"wordCount\":879,\"commentCount\":1,\"image\":{\"@id\":\"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/serkanseker.com\/tr\/wp-content\/uploads\/2020\/12\/Xamarin.Forms-MVVM-Pattern.jpg\",\"keywords\":[\"MVVM\",\"xamarin\",\"xamarin.forms\"],\"articleSection\":[\"Xamarin\",\"Xamarin.Forms\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/\",\"url\":\"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/\",\"name\":\"Xamarin.Forms MVVM Pattern - Serkan Seker TR\",\"isPartOf\":{\"@id\":\"https:\/\/serkanseker.com\/tr\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/serkanseker.com\/tr\/wp-content\/uploads\/2020\/12\/Xamarin.Forms-MVVM-Pattern.jpg\",\"datePublished\":\"2020-10-29T18:03:12+00:00\",\"dateModified\":\"2021-02-22T07:41:59+00:00\",\"author\":{\"@id\":\"https:\/\/serkanseker.com\/tr\/#\/schema\/person\/841fcc69b248e08e52c4190963caeaf5\"},\"breadcrumb\":{\"@id\":\"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/#primaryimage\",\"url\":\"https:\/\/serkanseker.com\/tr\/wp-content\/uploads\/2020\/12\/Xamarin.Forms-MVVM-Pattern.jpg\",\"contentUrl\":\"https:\/\/serkanseker.com\/tr\/wp-content\/uploads\/2020\/12\/Xamarin.Forms-MVVM-Pattern.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/serkanseker.com\/tr\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Xamarin.Forms MVVM Pattern\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/serkanseker.com\/tr\/#website\",\"url\":\"https:\/\/serkanseker.com\/tr\/\",\"name\":\"Serkan Seker TR\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/serkanseker.com\/tr\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/serkanseker.com\/tr\/#\/schema\/person\/841fcc69b248e08e52c4190963caeaf5\",\"name\":\"serkanadmin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/serkanseker.com\/tr\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/93ddc1f96117bf468976afe93a077eda77de96bcdb48dc749903598a546786a3?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/93ddc1f96117bf468976afe93a077eda77de96bcdb48dc749903598a546786a3?s=96&d=mm&r=g\",\"caption\":\"serkanadmin\"},\"sameAs\":[\"https:\/\/serkanseker.com\"],\"url\":\"https:\/\/serkanseker.com\/tr\/author\/serkanadmin\/\"},{\"@type\":\"HowTo\",\"@id\":\"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/#howto-1\",\"name\":\"Xamarin.Forms MVVM Pattern\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/#article\"},\"description\":\"\",\"step\":[{\"@type\":\"HowToStep\",\"url\":\"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/#how-to-step-1604079051470\",\"text\":\"MVVM Design Pattern\"},{\"@type\":\"HowToStep\",\"url\":\"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/#how-to-step-1604079063418\",\"text\":\"MVVM (Model-View-ViewModel)\"},{\"@type\":\"HowToStep\",\"url\":\"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/#how-to-step-1604079064630\",\"text\":\"Binding ViewModel to View\"},{\"@type\":\"HowToStep\",\"url\":\"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/#how-to-step-1604079065131\",\"text\":\"Updating View in Response to Changes in MVVM\"},{\"@type\":\"HowToStep\",\"url\":\"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/#how-to-step-1604079065295\",\"text\":\"Implementing Commands\"},{\"@type\":\"HowToStep\",\"url\":\"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/#how-to-step-1604079065429\",\"text\":\"Advantages of MVVM Pattern\"},{\"@type\":\"HowToStep\",\"url\":\"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/#how-to-step-1604079108076\",\"text\":\"Disadvantages of MVVM Pattern\"},{\"@type\":\"HowToStep\",\"url\":\"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/#how-to-step-1604079119054\",\"text\":\"Conclusion\"}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Xamarin.Forms MVVM Pattern - Serkan Seker TR","robots":{"index":"noindex","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"og_locale":"en_US","og_type":"article","og_title":"Xamarin.Forms MVVM Pattern - Serkan Seker TR","og_description":"MVVM (Model - View - ViewModel) model separates the business and presentation layers of an application from the user interface. This separation helps make testing, maintenance, and development of an application easier. Naturally, it enables designers and developers to collaborate more harmoniously.","og_url":"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/","og_site_name":"Serkan Seker TR","article_published_time":"2020-10-29T18:03:12+00:00","article_modified_time":"2021-02-22T07:41:59+00:00","og_image":[{"url":"https:\/\/serkanseker.com\/tr\/wp-content\/uploads\/2020\/12\/Xamarin.Forms-MVVM-Pattern.jpg","width":1,"height":1,"type":"image\/jpeg"}],"author":"serkanadmin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"serkanadmin","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/#article","isPartOf":{"@id":"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/"},"author":{"name":"serkanadmin","@id":"https:\/\/serkanseker.com\/tr\/#\/schema\/person\/841fcc69b248e08e52c4190963caeaf5"},"headline":"Xamarin.Forms MVVM Pattern","datePublished":"2020-10-29T18:03:12+00:00","dateModified":"2021-02-22T07:41:59+00:00","mainEntityOfPage":{"@id":"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/"},"wordCount":879,"commentCount":1,"image":{"@id":"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/#primaryimage"},"thumbnailUrl":"https:\/\/serkanseker.com\/tr\/wp-content\/uploads\/2020\/12\/Xamarin.Forms-MVVM-Pattern.jpg","keywords":["MVVM","xamarin","xamarin.forms"],"articleSection":["Xamarin","Xamarin.Forms"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/","url":"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/","name":"Xamarin.Forms MVVM Pattern - Serkan Seker TR","isPartOf":{"@id":"https:\/\/serkanseker.com\/tr\/#website"},"primaryImageOfPage":{"@id":"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/#primaryimage"},"image":{"@id":"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/#primaryimage"},"thumbnailUrl":"https:\/\/serkanseker.com\/tr\/wp-content\/uploads\/2020\/12\/Xamarin.Forms-MVVM-Pattern.jpg","datePublished":"2020-10-29T18:03:12+00:00","dateModified":"2021-02-22T07:41:59+00:00","author":{"@id":"https:\/\/serkanseker.com\/tr\/#\/schema\/person\/841fcc69b248e08e52c4190963caeaf5"},"breadcrumb":{"@id":"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/#primaryimage","url":"https:\/\/serkanseker.com\/tr\/wp-content\/uploads\/2020\/12\/Xamarin.Forms-MVVM-Pattern.jpg","contentUrl":"https:\/\/serkanseker.com\/tr\/wp-content\/uploads\/2020\/12\/Xamarin.Forms-MVVM-Pattern.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/serkanseker.com\/tr\/"},{"@type":"ListItem","position":2,"name":"Xamarin.Forms MVVM Pattern"}]},{"@type":"WebSite","@id":"https:\/\/serkanseker.com\/tr\/#website","url":"https:\/\/serkanseker.com\/tr\/","name":"Serkan Seker TR","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/serkanseker.com\/tr\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/serkanseker.com\/tr\/#\/schema\/person\/841fcc69b248e08e52c4190963caeaf5","name":"serkanadmin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/serkanseker.com\/tr\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/93ddc1f96117bf468976afe93a077eda77de96bcdb48dc749903598a546786a3?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/93ddc1f96117bf468976afe93a077eda77de96bcdb48dc749903598a546786a3?s=96&d=mm&r=g","caption":"serkanadmin"},"sameAs":["https:\/\/serkanseker.com"],"url":"https:\/\/serkanseker.com\/tr\/author\/serkanadmin\/"},{"@type":"HowTo","@id":"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/#howto-1","name":"Xamarin.Forms MVVM Pattern","mainEntityOfPage":{"@id":"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/#article"},"description":"","step":[{"@type":"HowToStep","url":"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/#how-to-step-1604079051470","text":"MVVM Design Pattern"},{"@type":"HowToStep","url":"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/#how-to-step-1604079063418","text":"MVVM (Model-View-ViewModel)"},{"@type":"HowToStep","url":"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/#how-to-step-1604079064630","text":"Binding ViewModel to View"},{"@type":"HowToStep","url":"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/#how-to-step-1604079065131","text":"Updating View in Response to Changes in MVVM"},{"@type":"HowToStep","url":"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/#how-to-step-1604079065295","text":"Implementing Commands"},{"@type":"HowToStep","url":"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/#how-to-step-1604079065429","text":"Advantages of MVVM Pattern"},{"@type":"HowToStep","url":"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/#how-to-step-1604079108076","text":"Disadvantages of MVVM Pattern"},{"@type":"HowToStep","url":"https:\/\/serkanseker.com\/tr\/xamarin-forms-mvvm-pattern\/#how-to-step-1604079119054","text":"Conclusion"}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/serkanseker.com\/tr\/wp-json\/wp\/v2\/posts\/1645","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/serkanseker.com\/tr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/serkanseker.com\/tr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/serkanseker.com\/tr\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/serkanseker.com\/tr\/wp-json\/wp\/v2\/comments?post=1645"}],"version-history":[{"count":0,"href":"https:\/\/serkanseker.com\/tr\/wp-json\/wp\/v2\/posts\/1645\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/serkanseker.com\/tr\/wp-json\/wp\/v2\/media\/216"}],"wp:attachment":[{"href":"https:\/\/serkanseker.com\/tr\/wp-json\/wp\/v2\/media?parent=1645"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/serkanseker.com\/tr\/wp-json\/wp\/v2\/categories?post=1645"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/serkanseker.com\/tr\/wp-json\/wp\/v2\/tags?post=1645"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}