{"id":37609,"date":"2024-11-01T09:58:57","date_gmt":"2024-11-01T09:58:57","guid":{"rendered":"http:\/\/atmokpo.com\/w\/?p=37609"},"modified":"2024-11-01T11:02:02","modified_gmt":"2024-11-01T11:02:02","slug":"uwp-development-markup-extension","status":"publish","type":"post","link":"https:\/\/atmokpo.com\/w\/37609\/","title":{"rendered":"UWP Development, Markup Extension"},"content":{"rendered":"<p><body><\/p>\n<article>\n<header>\n<p>Last updated: October 12, 2023<\/p>\n<\/header>\n<section>\n<h2>Introduction<\/h2>\n<p>\n                Universal Windows Platform (UWP) is a heterogeneous platform developed by Microsoft that provides the tools and APIs necessary for creating applications that run on various Windows 10 devices. UWP applications use a specific UI markup language called XAML (Extensible Application Markup Language) to define their UI. This article presents an in-depth explanation of UWP&#8217;s markup extensions along with example code.\n            <\/p>\n<\/section>\n<section>\n<h2>Basics of XAML<\/h2>\n<p>\n                XAML is used to define all UI components such as UI elements, data binding, and styles. By using XAML, you can declaratively build a UI, and UWP inherently supports various types of UI elements and controls. The syntax of XAML is similar to HTML, but it is designed to operate within the Windows environment.\n            <\/p>\n<h3>Example: Basic XAML Structure<\/h3>\n<pre><code>&lt;Page\n    x:Class=\"MyApp.MainPage\"\n    xmlns=\"http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml\/presentation\"\n    xmlns:x=\"http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml\"\n    xmlns:local=\"using:MyApp\"\n    xmlns:d=\"http:\/\/schemas.microsoft.com\/expression\/blend\/2008\"\n    xmlns:mc=\"http:\/\/schemas.openxmlformats.org\/markup-compatibility\/2006\"\n    mc:Ignorable=\"d\"&gt;\n\n    &lt;Grid Background=\"{ThemeResource ApplicationPageBackgroundThemeBrush}\"&gt;\n        &lt;TextBlock Text=\"Hello, UWP!\" HorizontalAlignment=\"Center\" VerticalAlignment=\"Center\" FontSize=\"24\"\/&gt;\n    &lt;\/Grid&gt;\n\n&lt;\/Page&gt;<\/code><\/pre>\n<\/section>\n<section>\n<h2>The Need for Markup Extensions<\/h2>\n<p>\n                UWP provides a rich set of UI components by default. However, to meet specific requirements, it may be necessary to extend existing markup languages or create custom controls. Markup extensions can provide ongoing solutions for these needs and enhance UI reusability.\n            <\/p>\n<p>\n                For example, you can create a custom button to implement specific styles or behaviors. This increases code reusability and improves maintainability.\n            <\/p>\n<\/section>\n<section>\n<h2>Creating Markup Extensions<\/h2>\n<p>\n                Now, let&#8217;s look at how to actually create markup extensions. Custom controls can be created by inheriting from UserControl and can be used alongside existing XAML.\n            <\/p>\n<h3>Example: Creating a Custom Button<\/h3>\n<p>\n                Below is the process for creating a custom button. This button can dynamically set text and background color.\n            <\/p>\n<pre><code>&lt;UserControl\n    x:Class=\"MyApp.CustomButton\"\n    xmlns=\"http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml\/presentation\"\n    xmlns:x=\"http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml\"\n    x:Name=\"customButton\"&gt;\n\n    &lt;Border Background=\"{Binding BackgroundColor, ElementName=customButton}\" CornerRadius=\"5\" Padding=\"10\"&gt;\n        &lt;TextBlock Text=\"{Binding ButtonText, ElementName=customButton}\" Foreground=\"White\" FontSize=\"16\"\/&gt;\n    &lt;\/Border&gt;\n\n&lt;\/UserControl&gt;<\/code><\/pre>\n<h3>Code Behind: CustomButton.xaml.cs<\/h3>\n<pre><code>using Windows.UI.Xaml.Controls;\n\nnamespace MyApp\n{\n    public sealed partial class CustomButton : UserControl\n    {\n        public static readonly DependencyProperty ButtonTextProperty =\n            DependencyProperty.Register(\"ButtonText\", typeof(string), typeof(CustomButton), null);\n        \n        public string ButtonText\n        {\n            get { return (string)GetValue(ButtonTextProperty); }\n            set { SetValue(ButtonTextProperty, value); }\n        }\n\n        public static readonly DependencyProperty BackgroundColorProperty =\n            DependencyProperty.Register(\"BackgroundColor\", typeof(Windows.UI.Color), typeof(CustomButton), null);\n        \n        public Windows.UI.Color BackgroundColor\n        {\n            get { return (Windows.UI.Color)GetValue(BackgroundColorProperty); }\n            set { SetValue(BackgroundColorProperty, value); }\n        }\n\n        public CustomButton()\n        {\n            this.InitializeComponent();\n        }\n    }\n}<\/code><\/pre>\n<h3>Usage<\/h3>\n<p>\n                You can define how to use the custom button as follows.\n            <\/p>\n<pre><code>&lt;local:CustomButton ButtonText=\"Click Me\" BackgroundColor=\"Blue\" \/&gt;<\/code><\/pre>\n<\/section>\n<section>\n<h2>Considerations When Creating Markup Extensions<\/h2>\n<p>\n                When creating markup extensions, there are several important considerations. First, performance. Custom controls can sometimes lead to performance degradation, so it&#8217;s advisable to use them only when necessary. Second, accessibility. Custom controls should be developed with accessibility in mind and should be compatible with screen readers.\n            <\/p>\n<p>\n                Lastly, readability. As custom markup becomes more complex, it may become harder to use, so it is beneficial to document it well and provide sufficient examples.\n            <\/p>\n<\/section>\n<section>\n<h2>Conclusion<\/h2>\n<p>\n                Markup extensions in UWP enhance the flexibility and reusability of UI components, allowing users to meet more specific requirements. By creating custom controls, UWP applications can become more attractive, and these methods can increase efficiency in team collaborations.\n            <\/p>\n<p>\n                The development of UWP will continue to grow, and it is important to enhance understanding and skills in this area. I hope this article helps you in your UWP development journey.\n            <\/p>\n<\/section>\n<\/article>\n<p><\/body><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last updated: October 12, 2023 Introduction Universal Windows Platform (UWP) is a heterogeneous platform developed by Microsoft that provides the tools and APIs necessary for creating applications that run on various Windows 10 devices. UWP applications use a specific UI markup language called XAML (Extensible Application Markup Language) to define their UI. This article presents &hellip; <a href=\"https:\/\/atmokpo.com\/w\/37609\/\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;UWP Development, Markup Extension&#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-37609","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, Markup Extension - \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\/37609\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"UWP Development, Markup Extension - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"og:description\" content=\"Last updated: October 12, 2023 Introduction Universal Windows Platform (UWP) is a heterogeneous platform developed by Microsoft that provides the tools and APIs necessary for creating applications that run on various Windows 10 devices. UWP applications use a specific UI markup language called XAML (Extensible Application Markup Language) to define their UI. This article presents &hellip; \ub354 \ubcf4\uae30 &quot;UWP Development, Markup Extension&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/atmokpo.com\/w\/37609\/\" \/>\n<meta property=\"og:site_name\" content=\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-01T09:58:57+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-01T11:02:02+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\/37609\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/37609\/\"},\"author\":{\"name\":\"root\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\"},\"headline\":\"UWP Development, Markup Extension\",\"datePublished\":\"2024-11-01T09:58:57+00:00\",\"dateModified\":\"2024-11-01T11:02:02+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/atmokpo.com\/w\/37609\/\"},\"wordCount\":414,\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"articleSection\":[\"UWP Programming\"],\"inLanguage\":\"ko-KR\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/atmokpo.com\/w\/37609\/\",\"url\":\"https:\/\/atmokpo.com\/w\/37609\/\",\"name\":\"UWP Development, Markup Extension - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#website\"},\"datePublished\":\"2024-11-01T09:58:57+00:00\",\"dateModified\":\"2024-11-01T11:02:02+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/atmokpo.com\/w\/37609\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/atmokpo.com\/w\/37609\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/atmokpo.com\/w\/37609\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\ud648\",\"item\":\"https:\/\/atmokpo.com\/w\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"UWP Development, Markup Extension\"}]},{\"@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, Markup Extension - \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\/37609\/","og_locale":"ko_KR","og_type":"article","og_title":"UWP Development, Markup Extension - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","og_description":"Last updated: October 12, 2023 Introduction Universal Windows Platform (UWP) is a heterogeneous platform developed by Microsoft that provides the tools and APIs necessary for creating applications that run on various Windows 10 devices. UWP applications use a specific UI markup language called XAML (Extensible Application Markup Language) to define their UI. This article presents &hellip; \ub354 \ubcf4\uae30 \"UWP Development, Markup Extension\"","og_url":"https:\/\/atmokpo.com\/w\/37609\/","og_site_name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","article_published_time":"2024-11-01T09:58:57+00:00","article_modified_time":"2024-11-01T11:02:02+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\/37609\/#article","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/37609\/"},"author":{"name":"root","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7"},"headline":"UWP Development, Markup Extension","datePublished":"2024-11-01T09:58:57+00:00","dateModified":"2024-11-01T11:02:02+00:00","mainEntityOfPage":{"@id":"https:\/\/atmokpo.com\/w\/37609\/"},"wordCount":414,"publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"articleSection":["UWP Programming"],"inLanguage":"ko-KR"},{"@type":"WebPage","@id":"https:\/\/atmokpo.com\/w\/37609\/","url":"https:\/\/atmokpo.com\/w\/37609\/","name":"UWP Development, Markup Extension - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/#website"},"datePublished":"2024-11-01T09:58:57+00:00","dateModified":"2024-11-01T11:02:02+00:00","breadcrumb":{"@id":"https:\/\/atmokpo.com\/w\/37609\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/atmokpo.com\/w\/37609\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/atmokpo.com\/w\/37609\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\ud648","item":"https:\/\/atmokpo.com\/w\/en\/"},{"@type":"ListItem","position":2,"name":"UWP Development, Markup Extension"}]},{"@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\/37609","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=37609"}],"version-history":[{"count":1,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/37609\/revisions"}],"predecessor-version":[{"id":37610,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/37609\/revisions\/37610"}],"wp:attachment":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/media?parent=37609"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/categories?post=37609"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/tags?post=37609"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}