{"id":37505,"date":"2024-11-01T09:58:05","date_gmt":"2024-11-01T09:58:05","guid":{"rendered":"http:\/\/atmokpo.com\/w\/?p=37505"},"modified":"2024-11-01T11:02:28","modified_gmt":"2024-11-01T11:02:28","slug":"uwp-development-resource","status":"publish","type":"post","link":"https:\/\/atmokpo.com\/w\/37505\/","title":{"rendered":"UWP Development, Resource"},"content":{"rendered":"<p>The Windows Universal Platform (UWP) is a platform for developing applications that run on various Windows 10 devices. When creating UWP applications, resources play a very important role and are essential for the application&#8217;s style, layout, and multilingual support. This article will take a detailed look at the concept of resources in UWP development and explain it with actual example code.<\/p>\n<h2>1. Overview of Resources in UWP Applications<\/h2>\n<p>Resources are a collection of reusable content in an application, and they can exist in various forms, especially as styles, images, strings, and other UI elements. By using resources, you can increase code reusability and make maintenance easier.<\/p>\n<h3>1.1 Types of Resources<\/h3>\n<ul>\n<li><strong>StaticResource:<\/strong> Used to define resources that generally do not change. For example, it is suitable for colors or style definitions that are used repeatedly.<\/li>\n<li><strong>DynamicResource:<\/strong> Used to deal with resources that can change during application execution. It is useful in situations like theme changes.<\/li>\n<li><strong>Styles:<\/strong> Styles are used to define the visual representation of UI components. This helps to reduce code duplication.<\/li>\n<li><strong>Templates:<\/strong> Used to define the layout of UI elements, allowing you to set a custom appearance for specific UI components.<\/li>\n<\/ul>\n<h2>2. Defining UWP Resources<\/h2>\n<p>Below is an example showing how to define resources in a XAML file. This example includes defining colors and styles.<\/p>\n<pre><code class=\"language-xml\">&lt;Page.Resources&gt;\n    &lt;Color x:Key=\"PrimaryColor\"&gt;#FF6200EE&lt;\/Color&gt;\n    &lt;SolidColorBrush x:Key=\"PrimaryBrush\" Color=\"{StaticResource PrimaryColor}\" \/&gt;\n    \n    &lt;Style x:Key=\"ButtonStyle\" TargetType=\"Button\"&gt;\n        &lt;Setter Property=\"Background\" Value=\"{StaticResource PrimaryBrush}\" \/&gt;\n        &lt;Setter Property=\"Foreground\" Value=\"White\" \/&gt;\n        &lt;Setter Property=\"FontSize\" Value=\"16\" \/&gt;\n    &lt;\/Style&gt;\n&lt;\/Page.Resources&gt;<\/code><\/pre>\n<h3>2.1 Locations of Resources<\/h3>\n<p>Resources can be defined in several places. Here are the main locations where resources can be defined:<\/p>\n<ul>\n<li><strong>Application.xaml:<\/strong> Defines resources that can be used throughout the application.<\/li>\n<li><strong>Page.xaml:<\/strong> Defines resources that can only be used on a specific page.<\/li>\n<li><strong>Resources Folder:<\/strong> Manages string resources for multilingual support by adding resource files (.resx).<\/li>\n<\/ul>\n<h2>3. Using Resources<\/h2>\n<p>The defined resources can be bound to various elements in XAML. Below is an example of applying a style to a button.<\/p>\n<pre><code class=\"language-xml\">&lt;Button Content=\"Click Me\" Style=\"{StaticResource ButtonStyle}\" \/&gt;<\/code><\/pre>\n<h3>3.1 Dynamic Resource Conversion<\/h3>\n<p>You can add functionality for users to change themes using dynamic resources. Below is the code for dynamically changing the background color.<\/p>\n<pre><code class=\"language-xml\">&lt;Grid Background=\"{DynamicResource BackgroundBrush}\"&gt;<\/code><\/pre>\n<h2>4. Resources for Multilingual Support<\/h2>\n<p>Multilingual support is one of the important elements in UWP development. To achieve this, resource dictionaries (.resx files) are used. By defining string resources in separate files, various languages can be supported.<\/p>\n<pre><code class=\"language-csharp\">using System.Globalization;\nusing Windows.ApplicationModel.Resources;\n\n\/\/ Example of using string resources\nvar resourceLoader = ResourceLoader.GetForCurrentView();\nstring welcomeMessage = resourceLoader.GetString(\"WelcomeMessage\");<\/code><\/pre>\n<h3>4.1 Creating Resource Files<\/h3>\n<p>The following is how to add resource files in Visual Studio:<\/p>\n<ol>\n<li>Right-click on the project and select &#8220;Add&#8221; -&gt; &#8220;New Item&#8221;.<\/li>\n<li>Select &#8220;Resource File&#8221; and enter a file name.<\/li>\n<li>Add resource files for each language (e.g., Strings.resx, Strings.fr.resx, etc.).<\/li>\n<\/ol>\n<h2>5. Resource Optimization in UWP<\/h2>\n<p>Optimizing resources contributes to improving application performance and reducing load times. It is important to remove unnecessary resources and use only the required resources efficiently.<\/p>\n<h2>6. Conclusion<\/h2>\n<p>Resources play an important role in managing UI elements and providing multilingual support in UWP applications. By using resources effectively, you can greatly enhance the maintainability and usability of the application. Practice the various resource concepts and examples described in this article to broaden your understanding of UWP development.<\/p>\n<h2>7. Additional Resources<\/h2>\n<ul>\n<li><a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/uwp\/learn\/uwp-resources\">Official Documentation on UWP Resources<\/a><\/li>\n<li><a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/uwp\/design\/responsive\/designing-for-different-sizes\">Designing for Different Screen Sizes and Resolutions<\/a><\/li>\n<li><a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/uwp\/design\/localization\/globalizing-and-localizing-uwp-apps\">Internationalization and Localization of UWP Applications<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>The Windows Universal Platform (UWP) is a platform for developing applications that run on various Windows 10 devices. When creating UWP applications, resources play a very important role and are essential for the application&#8217;s style, layout, and multilingual support. This article will take a detailed look at the concept of resources in UWP development and &hellip; <a href=\"https:\/\/atmokpo.com\/w\/37505\/\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;UWP Development, Resource&#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-37505","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, Resource - \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\/37505\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"UWP Development, Resource - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"og:description\" content=\"The Windows Universal Platform (UWP) is a platform for developing applications that run on various Windows 10 devices. When creating UWP applications, resources play a very important role and are essential for the application&#8217;s style, layout, and multilingual support. This article will take a detailed look at the concept of resources in UWP development and &hellip; \ub354 \ubcf4\uae30 &quot;UWP Development, Resource&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/atmokpo.com\/w\/37505\/\" \/>\n<meta property=\"og:site_name\" content=\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-01T09:58:05+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\/37505\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/37505\/\"},\"author\":{\"name\":\"root\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\"},\"headline\":\"UWP Development, Resource\",\"datePublished\":\"2024-11-01T09:58:05+00:00\",\"dateModified\":\"2024-11-01T11:02:28+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/atmokpo.com\/w\/37505\/\"},\"wordCount\":504,\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"articleSection\":[\"UWP Programming\"],\"inLanguage\":\"ko-KR\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/atmokpo.com\/w\/37505\/\",\"url\":\"https:\/\/atmokpo.com\/w\/37505\/\",\"name\":\"UWP Development, Resource - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#website\"},\"datePublished\":\"2024-11-01T09:58:05+00:00\",\"dateModified\":\"2024-11-01T11:02:28+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/atmokpo.com\/w\/37505\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/atmokpo.com\/w\/37505\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/atmokpo.com\/w\/37505\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\ud648\",\"item\":\"https:\/\/atmokpo.com\/w\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"UWP Development, Resource\"}]},{\"@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, Resource - \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\/37505\/","og_locale":"ko_KR","og_type":"article","og_title":"UWP Development, Resource - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","og_description":"The Windows Universal Platform (UWP) is a platform for developing applications that run on various Windows 10 devices. When creating UWP applications, resources play a very important role and are essential for the application&#8217;s style, layout, and multilingual support. This article will take a detailed look at the concept of resources in UWP development and &hellip; \ub354 \ubcf4\uae30 \"UWP Development, Resource\"","og_url":"https:\/\/atmokpo.com\/w\/37505\/","og_site_name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","article_published_time":"2024-11-01T09:58:05+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\/37505\/#article","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/37505\/"},"author":{"name":"root","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7"},"headline":"UWP Development, Resource","datePublished":"2024-11-01T09:58:05+00:00","dateModified":"2024-11-01T11:02:28+00:00","mainEntityOfPage":{"@id":"https:\/\/atmokpo.com\/w\/37505\/"},"wordCount":504,"publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"articleSection":["UWP Programming"],"inLanguage":"ko-KR"},{"@type":"WebPage","@id":"https:\/\/atmokpo.com\/w\/37505\/","url":"https:\/\/atmokpo.com\/w\/37505\/","name":"UWP Development, Resource - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/#website"},"datePublished":"2024-11-01T09:58:05+00:00","dateModified":"2024-11-01T11:02:28+00:00","breadcrumb":{"@id":"https:\/\/atmokpo.com\/w\/37505\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/atmokpo.com\/w\/37505\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/atmokpo.com\/w\/37505\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\ud648","item":"https:\/\/atmokpo.com\/w\/en\/"},{"@type":"ListItem","position":2,"name":"UWP Development, Resource"}]},{"@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\/37505","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=37505"}],"version-history":[{"count":1,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/37505\/revisions"}],"predecessor-version":[{"id":37506,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/37505\/revisions\/37506"}],"wp:attachment":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/media?parent=37505"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/categories?post=37505"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/tags?post=37505"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}