{"id":37501,"date":"2024-11-01T09:58:04","date_gmt":"2024-11-01T09:58:04","guid":{"rendered":"http:\/\/atmokpo.com\/w\/?p=37501"},"modified":"2024-11-01T11:02:28","modified_gmt":"2024-11-01T11:02:28","slug":"uwp-development-resources-provided-by-prism","status":"publish","type":"post","link":"https:\/\/atmokpo.com\/w\/37501\/","title":{"rendered":"UWP Development, Resources Provided by Prism"},"content":{"rendered":"<p>\n    UWP (Universal Windows Platform) development is a platform for developing applications that run on Windows 10 and later Windows operating systems. These applications can run on various devices (PCs, tablets, Xbox, etc.) and provide a high level of user experience in terms of user interface (UI), performance, accessibility, security, and more. In UWP development, Prism is a useful framework that supports the MVVM (Model-View-ViewModel) architectural pattern, and the various resources provided within this framework contribute to enhancing the quality and productivity of applications.\n<\/p>\n<h2>Overview of the Prism Framework<\/h2>\n<p>\n    Prism is a framework that can be used across several platforms like WPF (Windows Presentation Foundation), Xamarin.Forms, and UWP. It primarily offers the following features:\n<\/p>\n<ul>\n<li><strong>Modularity:<\/strong> It separates the application into smaller modules, making it easier to manage.<\/li>\n<li><strong>Support for MVVM Pattern:<\/strong> It enhances testability and maintainability by separating the view and business logic.<\/li>\n<li><strong>Command and Event Aggregator:<\/strong> Simplifies communication between components.<\/li>\n<li><strong>Navigation:<\/strong> Supports efficient and clear transitions between pages.<\/li>\n<\/ul>\n<h2>Resources of Prism<\/h2>\n<p>\n    Prism maximizes development efficiency by defining and reusing shareable resources. These resources are primarily provided in the following forms:\n<\/p>\n<h3>1. Styles<\/h3>\n<p>\n    Various styles can be defined to maintain UI consistency in UWP applications. Prism provides several common styles by default. These styles are managed through a `ResourceDictionary` and can be easily used in XAML.\n<\/p>\n<pre><code class=\"language-xml\">\n<resourcedictionary>\n    <style targettype=\"Button\">\n        <Setter Property=\"Background\" Value=\"Blue\"\/>\n        <Setter Property=\"Foreground\" Value=\"White\"\/>\n        <Setter Property=\"FontSize\" Value=\"16\"\/>\n    <\/style>\n<\/resourcedictionary>\n<\/code><\/pre>\n<h3>2. Control Templates<\/h3>\n<p>\n    Control Templates define the appearance of UI elements. Prism provides reusable Control Templates to maintain consistent visual representation of various UI elements.\n<\/p>\n<pre><code class=\"language-xml\">\n<controltemplate x:key=\"CustomButtonTemplate\">\n    <border background=\"{TemplateBinding Background}\">\n        <contentpresenter><\/contentpresenter>\n    <\/border>\n<\/controltemplate>\n<\/code><\/pre>\n<h3>3. Converters<\/h3>\n<p>\n    Converters are resources used to transform data types during data binding. Prism provides several built-in converters to support binding according to the type of data.\n<\/p>\n<pre><code class=\"language-csharp\">\npublic class BooleanToVisibilityConverter : IValueConverter\n{\n    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)\n    {\n        if (value is bool boolean)\n        {\n            return boolean ? Visibility.Visible : Visibility.Collapsed;\n        }\n        return Visibility.Collapsed;\n    }\n\n    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)\n    {\n        return value is Visibility visibility && visibility == Visibility.Visible;\n    }\n}\n<\/code><\/pre>\n<h3>4. Behaviors<\/h3>\n<p>\n    Behaviors are functionalities that work alongside UI elements to add behavior. Prism provides various Behaviors to easily add new functionalities to UI components. This enhances code decoupling and reusability.\n<\/p>\n<pre><code class=\"language-xml\">\n<button content=\"Click me\">\n    <interactivity:interaction.triggers>\n        <interactivity:eventtrigger eventname=\"Click\">\n            <interactivity:invokecommandaction command=\"{Binding MyCommand}\"><\/interactivity:invokecommandaction>\n        <\/interactivity:eventtrigger>\n    <\/interactivity:interaction.triggers>\n<\/button>\n<\/code><\/pre>\n<h2>Example of Using Prism Resources<\/h2>\n<p>\n    Below is an example of developing a UWP application using Prism&#8217;s resources. This example implements a simple application that displays a message when the user clicks a button.\n<\/p>\n<h3>1. XAML Setup<\/h3>\n<p>\n    First, we define the Styles, Control Templates, and Behaviors that will be used in the MainPage.xaml file.\n<\/p>\n<pre><code class=\"language-xml\">\n<page x:class=\"MyApp.Views.MainPage\" xmlns=\"http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml\/presentation\" xmlns:interactivity=\"using:Microsoft.Xaml.Interactions\" xmlns:local=\"using:MyApp\" xmlns:x=\"http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml\">\n    \n    <page.resources>\n        <resourcedictionary>\n            <style targettype=\"Button\" x:key=\"CustomButtonStyle\">\n                <Setter Property=\"Background\" Value=\"LightBlue\"\/>\n                <Setter Property=\"Foreground\" Value=\"DarkBlue\"\/>\n            <\/style>\n        <\/resourcedictionary>\n    <\/page.resources>\n\n    <grid>\n        <button command=\"{Binding MyCommand}\" content=\"Click Me\" style=\"{StaticResource CustomButtonStyle}\">\n        <\/button>\n    <\/grid>\n<\/page>\n<\/code><\/pre>\n<h3>2. ViewModel Setup<\/h3>\n<p>\n    Next, we create the ViewModel to define the action that occurs on button click.\n<\/p>\n<pre><code class=\"language-csharp\">\nusing Prism.Commands;\nusing Prism.Mvvm;\nusing System;\n\nnamespace MyApp.ViewModels\n{\n    public class MainPageViewModel : BindableBase\n    {\n        private string _message;\n        public string Message\n        {\n            get { return _message; }\n            set { SetProperty(ref _message, value); }\n        }\n\n        public DelegateCommand MyCommand { get; private set; }\n\n        public MainPageViewModel()\n        {\n            MyCommand = new DelegateCommand(OnMyCommandExecuted);\n        }\n\n        private void OnMyCommandExecuted()\n        {\n            Message = \"Button was clicked!\";\n        }\n    }\n}\n<\/code><\/pre>\n<h3>3. App Entry Point Setup<\/h3>\n<p>\n    Finally, we set up the entry point of the application and bind the View and ViewModel.\n<\/p>\n<pre><code class=\"language-csharp\">\nusing Prism.Ioc;\nusing Prism.Unity;\nusing Windows.UI.Xaml;\nusing MyApp.Views;\n\nnamespace MyApp\n{\n    sealed partial class App : PrismApplication\n    {\n        public App() : base() { }\n\n        protected override void RegisterTypes(IContainerRegistry containerRegistry)\n        {\n            containerRegistry.RegisterForNavigation<MainPage>();\n        }\n\n        protected override void OnInitialized()\n        {\n            this.InitializeComponent();\n            NavigationService.NavigateAsync(\"MainPage\");\n        }\n    }\n}\n<\/mainpage><\/code><\/pre>\n<h2>Conclusion<\/h2>\n<p>\n    By appropriately utilizing the resources provided by Prism when developing UWP applications, you can write more efficient and maintainable code. Styles, Control Templates, Converters, and Behaviors are all elements that enhance the UI and user experience of the application. Through these resources, you can increase code reusability and deepen your understanding of the MVC pattern.\n<\/p>\n<p>\n    I hope this blog post helps you understand how to utilize Prism&#8217;s resources and apply them in actual applications. UWP development will offer more opportunities in the future, and Prism is one of the best tools to accompany you on this journey.\n<\/p>\n<h2>References<\/h2>\n<ul>\n<li><a href=\"https:\/\/prismlibrary.com\">Prism Documentation<\/a><\/li>\n<li><a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/uwp\/get-started\/\">UWP Get Started<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>UWP (Universal Windows Platform) development is a platform for developing applications that run on Windows 10 and later Windows operating systems. These applications can run on various devices (PCs, tablets, Xbox, etc.) and provide a high level of user experience in terms of user interface (UI), performance, accessibility, security, and more. In UWP development, Prism &hellip; <a href=\"https:\/\/atmokpo.com\/w\/37501\/\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;UWP Development, Resources Provided by Prism&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[115],"tags":[],"class_list":["post-37501","post","type-post","status-publish","format-standard","hentry","category-uwp-programming"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>UWP Development, Resources Provided by Prism - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/atmokpo.com\/w\/37501\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"UWP Development, Resources Provided by Prism - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"og:description\" content=\"UWP (Universal Windows Platform) development is a platform for developing applications that run on Windows 10 and later Windows operating systems. These applications can run on various devices (PCs, tablets, Xbox, etc.) and provide a high level of user experience in terms of user interface (UI), performance, accessibility, security, and more. In UWP development, Prism &hellip; \ub354 \ubcf4\uae30 &quot;UWP Development, Resources Provided by Prism&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/atmokpo.com\/w\/37501\/\" \/>\n<meta property=\"og:site_name\" content=\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-01T09:58:04+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-01T11:02:28+00:00\" \/>\n<meta name=\"author\" content=\"root\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:site\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:label1\" content=\"\uae00\uc4f4\uc774\" \/>\n\t<meta name=\"twitter:data1\" content=\"root\" \/>\n\t<meta name=\"twitter:label2\" content=\"\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04\" \/>\n\t<meta name=\"twitter:data2\" content=\"3\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/atmokpo.com\/w\/37501\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/37501\/\"},\"author\":{\"name\":\"root\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\"},\"headline\":\"UWP Development, Resources Provided by Prism\",\"datePublished\":\"2024-11-01T09:58:04+00:00\",\"dateModified\":\"2024-11-01T11:02:28+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/atmokpo.com\/w\/37501\/\"},\"wordCount\":495,\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"articleSection\":[\"UWP Programming\"],\"inLanguage\":\"ko-KR\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/atmokpo.com\/w\/37501\/\",\"url\":\"https:\/\/atmokpo.com\/w\/37501\/\",\"name\":\"UWP Development, Resources Provided by Prism - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#website\"},\"datePublished\":\"2024-11-01T09:58:04+00:00\",\"dateModified\":\"2024-11-01T11:02:28+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/atmokpo.com\/w\/37501\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/atmokpo.com\/w\/37501\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/atmokpo.com\/w\/37501\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\ud648\",\"item\":\"https:\/\/atmokpo.com\/w\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"UWP Development, Resources Provided by Prism\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/atmokpo.com\/w\/#website\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/atmokpo.com\/w\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ko-KR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"contentUrl\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"width\":400,\"height\":400,\"caption\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\"},\"image\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/bebubo4\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\",\"name\":\"root\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"caption\":\"root\"},\"sameAs\":[\"http:\/\/atmokpo.com\/w\"],\"url\":\"https:\/\/atmokpo.com\/w\/author\/root\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"UWP Development, Resources Provided by Prism - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/atmokpo.com\/w\/37501\/","og_locale":"ko_KR","og_type":"article","og_title":"UWP Development, Resources Provided by Prism - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","og_description":"UWP (Universal Windows Platform) development is a platform for developing applications that run on Windows 10 and later Windows operating systems. These applications can run on various devices (PCs, tablets, Xbox, etc.) and provide a high level of user experience in terms of user interface (UI), performance, accessibility, security, and more. In UWP development, Prism &hellip; \ub354 \ubcf4\uae30 \"UWP Development, Resources Provided by Prism\"","og_url":"https:\/\/atmokpo.com\/w\/37501\/","og_site_name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","article_published_time":"2024-11-01T09:58:04+00:00","article_modified_time":"2024-11-01T11:02:28+00:00","author":"root","twitter_card":"summary_large_image","twitter_creator":"@bebubo4","twitter_site":"@bebubo4","twitter_misc":{"\uae00\uc4f4\uc774":"root","\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04":"3\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/atmokpo.com\/w\/37501\/#article","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/37501\/"},"author":{"name":"root","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7"},"headline":"UWP Development, Resources Provided by Prism","datePublished":"2024-11-01T09:58:04+00:00","dateModified":"2024-11-01T11:02:28+00:00","mainEntityOfPage":{"@id":"https:\/\/atmokpo.com\/w\/37501\/"},"wordCount":495,"publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"articleSection":["UWP Programming"],"inLanguage":"ko-KR"},{"@type":"WebPage","@id":"https:\/\/atmokpo.com\/w\/37501\/","url":"https:\/\/atmokpo.com\/w\/37501\/","name":"UWP Development, Resources Provided by Prism - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/#website"},"datePublished":"2024-11-01T09:58:04+00:00","dateModified":"2024-11-01T11:02:28+00:00","breadcrumb":{"@id":"https:\/\/atmokpo.com\/w\/37501\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/atmokpo.com\/w\/37501\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/atmokpo.com\/w\/37501\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\ud648","item":"https:\/\/atmokpo.com\/w\/en\/"},{"@type":"ListItem","position":2,"name":"UWP Development, Resources Provided by Prism"}]},{"@type":"WebSite","@id":"https:\/\/atmokpo.com\/w\/#website","url":"https:\/\/atmokpo.com\/w\/","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","description":"","publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/atmokpo.com\/w\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ko-KR"},{"@type":"Organization","@id":"https:\/\/atmokpo.com\/w\/#organization","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","url":"https:\/\/atmokpo.com\/w\/","logo":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/","url":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","contentUrl":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","width":400,"height":400,"caption":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8"},"image":{"@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/bebubo4"]},{"@type":"Person","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7","name":"root","image":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","caption":"root"},"sameAs":["http:\/\/atmokpo.com\/w"],"url":"https:\/\/atmokpo.com\/w\/author\/root\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/37501","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/comments?post=37501"}],"version-history":[{"count":1,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/37501\/revisions"}],"predecessor-version":[{"id":37502,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/37501\/revisions\/37502"}],"wp:attachment":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/media?parent=37501"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/categories?post=37501"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/tags?post=37501"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}