{"id":37615,"date":"2024-11-01T09:59:00","date_gmt":"2024-11-01T09:59:00","guid":{"rendered":"http:\/\/atmokpo.com\/w\/?p=37615"},"modified":"2024-11-01T11:02:00","modified_gmt":"2024-11-01T11:02:00","slug":"uwp-development-outputting-numbers-on-repeated-buttons-in-the-body","status":"publish","type":"post","link":"https:\/\/atmokpo.com\/w\/37615\/","title":{"rendered":"UWP Development, Outputting Numbers on Repeated Buttons in the Body"},"content":{"rendered":"<p>In today&#8217;s software development environment, the intuitive experience for users is increasingly emphasized. In particular, UWP (Universal Windows Platform) focuses on providing a consistent user experience across various devices. In this course, we will cover how to implement a feature that &#8216;displays a number on repeated buttons&#8217; while developing UWP applications.<\/p>\n<h2>Objectives<\/h2>\n<p>Through this course, users will implement the following features:<\/p>\n<ul>\n<li>A function that increments a number every time the user clicks a button<\/li>\n<li>How to dynamically create UI elements to manage multiple buttons and the displayed numbers<\/li>\n<li>How to structure UWP applications using XAML and C#<\/li>\n<\/ul>\n<h2>Setting Up the Development Environment<\/h2>\n<p>Before starting UWP application development, the following development environment must be set up:<\/p>\n<ul>\n<li>Windows 10 or later<\/li>\n<li>Visual Studio 2019 or later<\/li>\n<li>Installation of Visual Studio components that support UWP development<\/li>\n<\/ul>\n<h2>Creating a Project<\/h2>\n<p>Open Visual Studio and follow the steps to create a new UWP project:<\/p>\n<ol>\n<li>Select &#8216;New&#8217; from the &#8216;File&#8217; menu and click on &#8216;Project&#8217;.<\/li>\n<li>Choose &#8216;Blank App&#8217; and then select the UWP app template.<\/li>\n<li>Set the project&#8217;s name and storage location, then click the &#8216;Create&#8217; button.<\/li>\n<\/ol>\n<h2>Structuring the XAML Layout<\/h2>\n<p>Now, let&#8217;s modify the XAML file to set up a space to display buttons and numbers. Open the MainPage.xaml file and change it as follows:<\/p>\n<pre><code>&lt;Page\n    x:Class=\"YourAppNamespace.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:YourAppNamespace\"\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;StackPanel x:Name=\"ButtonContainer\"&gt;\n            &lt;TextBlock x:Name=\"CounterText\" FontSize=\"30\" Text=\"Number: 0\" \/&gt;\n        &lt;\/StackPanel&gt;\n    &lt;\/Grid&gt;\n&lt;\/Page&gt;<\/code><\/pre>\n<p>In the above code, we used <code>StackPanel<\/code> to stack the buttons and numbers. We also used the <code>TextBlock<\/code> element to display the current number.<\/p>\n<h2>Writing C# Code<\/h2>\n<p>After modifying the XAML file, we will write C# code to implement the button click events and number increment logic. Open the MainPage.xaml.cs file and add the code below:<\/p>\n<pre><code>using Windows.UI.Xaml;\nusing Windows.UI.Xaml.Controls;\n\nnamespace YourAppNamespace\n{\n    public sealed partial class MainPage : Page\n    {\n        private int buttonCount = 0;\n\n        public MainPage()\n        {\n            this.InitializeComponent();\n            SetupButtons();\n        }\n\n        private void SetupButtons()\n        {\n            for (int i = 0; i &lt; 5; i++)\n            {\n                Button btn = new Button();\n                btn.Content = $\"Button {i + 1}\";\n                btn.Width = 200;\n                btn.Click += Button_Click;\n                ButtonContainer.Children.Add(btn);\n            }\n        }\n\n        private void Button_Click(object sender, RoutedEventArgs e)\n        {\n            buttonCount++;\n            CounterText.Text = $\"Number: {buttonCount}\";\n        }\n    }\n}<\/code><\/pre>\n<p>In the code above, we:<\/p>\n<ul>\n<li>Called the <code>SetupButtons<\/code> method in the constructor to dynamically create the buttons.<\/li>\n<li>Connected a click event to each button so that when the user presses a button, the <code>Button_Click<\/code> method is triggered.<\/li>\n<li>Incremented the <code>buttonCount<\/code> variable on button clicks and updated the <code>TextBlock<\/code> text to display the current value.<\/li>\n<\/ul>\n<h2>Checking the Results<\/h2>\n<p>Now, build and run the project to check the results. When the app runs, the created buttons will be displayed on the screen. You will see the number increasing every time you click a button. Through this process, we learned some important concepts of UWP:<\/p>\n<ul>\n<li>Dynamic UI structure<\/li>\n<li>Event handling<\/li>\n<li>Data binding and updating<\/li>\n<\/ul>\n<h2>Additional Practice Problems<\/h2>\n<p>Now that the basic implementation is complete, consider the following additional practice problems to deepen your understanding:<\/p>\n<ul>\n<li>Modify the functionality to allow the user to input the total number of buttons to create that many buttons.<\/li>\n<li>Add a button to decrease the number and a reset button to create various states.<\/li>\n<li>Research how to add animation effects on button clicks to provide visual feedback to users.<\/li>\n<\/ul>\n<h2>Conclusion<\/h2>\n<p>This course covered how to implement repeated buttons that display numbers using UWP development. We learned how to handle events and create dynamic UI through basic XAML layout structure and C# code writing. UWP is a great platform for creating applications that can be used across various devices, providing users with a better experience.<\/p>\n<p>Now you have the foundational knowledge necessary to develop various apps using UWP. If you wish to implement more advanced features, consider learning about the diverse APIs and patterns of UWP.<\/p>\n<p>In the next course, we will cover other advanced features and best practices of UWP, so please stay tuned.<\/p>\n<p>Thank you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In today&#8217;s software development environment, the intuitive experience for users is increasingly emphasized. In particular, UWP (Universal Windows Platform) focuses on providing a consistent user experience across various devices. In this course, we will cover how to implement a feature that &#8216;displays a number on repeated buttons&#8217; while developing UWP applications. Objectives Through this course, &hellip; <a href=\"https:\/\/atmokpo.com\/w\/37615\/\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;UWP Development, Outputting Numbers on Repeated Buttons in the Body&#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-37615","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, Outputting Numbers on Repeated Buttons in the Body - \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\/37615\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"UWP Development, Outputting Numbers on Repeated Buttons in the Body - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"og:description\" content=\"In today&#8217;s software development environment, the intuitive experience for users is increasingly emphasized. In particular, UWP (Universal Windows Platform) focuses on providing a consistent user experience across various devices. In this course, we will cover how to implement a feature that &#8216;displays a number on repeated buttons&#8217; while developing UWP applications. Objectives Through this course, &hellip; \ub354 \ubcf4\uae30 &quot;UWP Development, Outputting Numbers on Repeated Buttons in the Body&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/atmokpo.com\/w\/37615\/\" \/>\n<meta property=\"og:site_name\" content=\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-01T09:59:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-01T11:02:00+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\/37615\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/37615\/\"},\"author\":{\"name\":\"root\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\"},\"headline\":\"UWP Development, Outputting Numbers on Repeated Buttons in the Body\",\"datePublished\":\"2024-11-01T09:59:00+00:00\",\"dateModified\":\"2024-11-01T11:02:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/atmokpo.com\/w\/37615\/\"},\"wordCount\":561,\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"articleSection\":[\"UWP Programming\"],\"inLanguage\":\"ko-KR\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/atmokpo.com\/w\/37615\/\",\"url\":\"https:\/\/atmokpo.com\/w\/37615\/\",\"name\":\"UWP Development, Outputting Numbers on Repeated Buttons in the Body - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#website\"},\"datePublished\":\"2024-11-01T09:59:00+00:00\",\"dateModified\":\"2024-11-01T11:02:00+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/atmokpo.com\/w\/37615\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/atmokpo.com\/w\/37615\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/atmokpo.com\/w\/37615\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\ud648\",\"item\":\"https:\/\/atmokpo.com\/w\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"UWP Development, Outputting Numbers on Repeated Buttons in the Body\"}]},{\"@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, Outputting Numbers on Repeated Buttons in the Body - \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\/37615\/","og_locale":"ko_KR","og_type":"article","og_title":"UWP Development, Outputting Numbers on Repeated Buttons in the Body - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","og_description":"In today&#8217;s software development environment, the intuitive experience for users is increasingly emphasized. In particular, UWP (Universal Windows Platform) focuses on providing a consistent user experience across various devices. In this course, we will cover how to implement a feature that &#8216;displays a number on repeated buttons&#8217; while developing UWP applications. Objectives Through this course, &hellip; \ub354 \ubcf4\uae30 \"UWP Development, Outputting Numbers on Repeated Buttons in the Body\"","og_url":"https:\/\/atmokpo.com\/w\/37615\/","og_site_name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","article_published_time":"2024-11-01T09:59:00+00:00","article_modified_time":"2024-11-01T11:02:00+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\/37615\/#article","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/37615\/"},"author":{"name":"root","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7"},"headline":"UWP Development, Outputting Numbers on Repeated Buttons in the Body","datePublished":"2024-11-01T09:59:00+00:00","dateModified":"2024-11-01T11:02:00+00:00","mainEntityOfPage":{"@id":"https:\/\/atmokpo.com\/w\/37615\/"},"wordCount":561,"publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"articleSection":["UWP Programming"],"inLanguage":"ko-KR"},{"@type":"WebPage","@id":"https:\/\/atmokpo.com\/w\/37615\/","url":"https:\/\/atmokpo.com\/w\/37615\/","name":"UWP Development, Outputting Numbers on Repeated Buttons in the Body - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/#website"},"datePublished":"2024-11-01T09:59:00+00:00","dateModified":"2024-11-01T11:02:00+00:00","breadcrumb":{"@id":"https:\/\/atmokpo.com\/w\/37615\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/atmokpo.com\/w\/37615\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/atmokpo.com\/w\/37615\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\ud648","item":"https:\/\/atmokpo.com\/w\/en\/"},{"@type":"ListItem","position":2,"name":"UWP Development, Outputting Numbers on Repeated Buttons in the Body"}]},{"@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\/37615","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=37615"}],"version-history":[{"count":1,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/37615\/revisions"}],"predecessor-version":[{"id":37616,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/37615\/revisions\/37616"}],"wp:attachment":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/media?parent=37615"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/categories?post=37615"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/tags?post=37615"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}