{"id":37515,"date":"2024-11-01T09:58:11","date_gmt":"2024-11-01T09:58:11","guid":{"rendered":"http:\/\/atmokpo.com\/w\/?p=37515"},"modified":"2024-11-01T11:02:25","modified_gmt":"2024-11-01T11:02:25","slug":"uwp-development-developing-simpledatagrid-app","status":"publish","type":"post","link":"https:\/\/atmokpo.com\/w\/37515\/","title":{"rendered":"UWP Development, Developing SimpleDataGrid App"},"content":{"rendered":"<p>UWP (Universal Windows Platform) is a platform for developing applications that can be used on Windows 10 and later versions. By using UWP, you can create a single application that runs on a variety of Windows devices. In this article, we will take a closer look at how to develop a SimpleDataGrid application using UWP.<\/p>\n<h2>1. Setting Up the UWP Development Environment<\/h2>\n<p>To develop UWP applications, a proper development environment is needed. You can set up the development environment by following these steps.<\/p>\n<ul>\n<li>\n<strong>Installing Visual Studio:<\/strong> You need to install Visual Studio for UWP development. It is recommended to use Visual Studio 2019 or later. During the installation, select the &#8220;UWP development&#8221; workload.\n    <\/li>\n<li>\n<strong>Windows 10 SDK:<\/strong> The Windows 10 SDK will be automatically installed during the installation of Visual Studio. The SDK includes the libraries and tools necessary for developing UWP applications.\n    <\/li>\n<\/ul>\n<h2>2. Overview of the SimpleDataGrid Application<\/h2>\n<p>The SimpleDataGrid app is an application that allows users to input data and displays this data in a list format. The main features of this app are:<\/p>\n<ul>\n<li>Providing a UI for users to input data<\/li>\n<li>Displaying the entered data in the DataGrid<\/li>\n<li>Feature to delete data added by the user<\/li>\n<\/ul>\n<h2>3. Creating a Project<\/h2>\n<p>First, let\u2019s create a new UWP project in Visual Studio. Follow these steps:<\/p>\n<ol>\n<li>Open Visual Studio and select &#8220;New Project.&#8221;<\/li>\n<li>Select &#8220;Blank Project,&#8221; enter the project name as &#8220;SimpleDataGrid,&#8221; and choose the path to save it.<\/li>\n<li>Click &#8220;Create&#8221; with the UWP platform selected by default.<\/li>\n<\/ol>\n<h2>4. Designing UI with XAML<\/h2>\n<p>Once the project is created, open the MainPage.xaml file to design the UI. Below is a simple XAML code that includes a DataGrid and a button.<\/p>\n<pre><code class=\"language-xaml\">\n<page background=\"{ThemeResource ApplicationPageBackgroundThemeBrush}\" mc:ignorable=\"d\" x:class=\"SimpleDataGrid.MainPage\" xmlns=\"http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml\/presentation\" xmlns:d=\"http:\/\/schemas.microsoft.com\/expression\/blend\/2008\" xmlns:local=\"using:SimpleDataGrid\" xmlns:mc=\"http:\/\/schemas.openxmlformats.org\/markup-compatibility\/2006\" xmlns:x=\"http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml\">\n\n    <grid>\n        <textbox margin=\"20\" placeholdertext=\"Enter data\" width=\"300\" x:name=\"InputTextBox\"><\/textbox>\n        <button click=\"OnAddButtonClick\" content=\"Add\" height=\"30\" margin=\"340,20,0,0\" width=\"100\"><\/button>\n        \n        <datagrid autogeneratecolumns=\"False\" margin=\"20,80,20,20\" x:name=\"DataGrid\">\n            <datagrid.columns>\n                <datagridtextcolumn binding=\"{Binding InputData}\" header=\"Input Data\" width=\"*\"><\/datagridtextcolumn>\n                <datagridtemplatecolumn header=\"Action\" width=\"120\">\n                    <datagridtemplatecolumn.celltemplate>\n                        <datatemplate>\n                            <button click=\"OnDeleteButtonClick\" content=\"Delete\"><\/button>\n                        <\/datatemplate>\n                    <\/datagridtemplatecolumn.celltemplate>\n                <\/datagridtemplatecolumn>\n            <\/datagrid.columns>\n        <\/datagrid>\n    <\/grid>\n<\/page>\n<\/code><\/pre>\n<h2>5. Writing C# Code<\/h2>\n<p>Now let&#8217;s use C# to write the button click events and the data model for the DataGrid. We will define a simple data model for the app.<\/p>\n<pre><code class=\"language-csharp\">\npublic class DataItem\n{\n    public string InputData { get; set; }\n}\n<\/code><\/pre>\n<p>Next, in the MainPage.xaml.cs file, write the following code:<\/p>\n<pre><code class=\"language-csharp\">\nusing System.Collections.ObjectModel;\nusing Windows.UI.Xaml;\nusing Windows.UI.Xaml.Controls;\n\nnamespace SimpleDataGrid\n{\n    public sealed partial class MainPage : Page\n    {\n        private ObservableCollection<DataItem> dataItems;\n\n        public MainPage()\n        {\n            this.InitializeComponent();\n            dataItems = new ObservableCollection<DataItem>();\n            DataGrid.ItemsSource = dataItems;\n        }\n\n        private void OnAddButtonClick(object sender, RoutedEventArgs e)\n        {\n            var newItem = new DataItem { InputData = InputTextBox.Text };\n            dataItems.Add(newItem);\n            InputTextBox.Text = string.Empty;\n        }\n\n        private void OnDeleteButtonClick(object sender, RoutedEventArgs e)\n        {\n            var button = sender as Button;\n            var item = button.DataContext as DataItem;\n            dataItems.Remove(item);\n        }\n    }\n}\n<\/dataitem><\/dataitem><\/code><\/pre>\n<h2>6. Running and Testing the App<\/h2>\n<p>After writing the code, press F5 to run the application. When the application runs, you can enter data in the input field and click the &#8220;Add&#8221; button to add data to the DataGrid. If you click the &#8220;Delete&#8221; button next to each data item, that item will be removed from the list.<\/p>\n<h2>7. Conclusion<\/h2>\n<p>In this tutorial, we explored the process of developing a SimpleDataGrid application using UWP. This application provides basic data input and management features and serves as a good example for understanding data binding and event handling in UWP. Furthermore, you can expand the actual application by adding complex data models, database connections, and various other features.<\/p>\n<h2>8. References<\/h2>\n<ul>\n<li>UWP Official Documentation: <a href=\"https:\/\/docs.microsoft.com\/windows\/uwp\/\">Microsoft Docs<\/a><\/li>\n<li>Understanding the MVVM Pattern: <a href=\"https:\/\/docs.microsoft.com\/windows\/apps\/design\/mvvm\/\">Microsoft Docs<\/a><\/li>\n<\/ul>\n<p>I hope this simple data grid app helps you learn the basics of UWP development and how to implement additional features.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>UWP (Universal Windows Platform) is a platform for developing applications that can be used on Windows 10 and later versions. By using UWP, you can create a single application that runs on a variety of Windows devices. In this article, we will take a closer look at how to develop a SimpleDataGrid application using UWP. &hellip; <a href=\"https:\/\/atmokpo.com\/w\/37515\/\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;UWP Development, Developing SimpleDataGrid App&#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-37515","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, Developing SimpleDataGrid App - \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\/37515\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"UWP Development, Developing SimpleDataGrid App - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"og:description\" content=\"UWP (Universal Windows Platform) is a platform for developing applications that can be used on Windows 10 and later versions. By using UWP, you can create a single application that runs on a variety of Windows devices. In this article, we will take a closer look at how to develop a SimpleDataGrid application using UWP. &hellip; \ub354 \ubcf4\uae30 &quot;UWP Development, Developing SimpleDataGrid App&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/atmokpo.com\/w\/37515\/\" \/>\n<meta property=\"og:site_name\" content=\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-01T09:58:11+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-01T11:02:25+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\/37515\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/37515\/\"},\"author\":{\"name\":\"root\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\"},\"headline\":\"UWP Development, Developing SimpleDataGrid App\",\"datePublished\":\"2024-11-01T09:58:11+00:00\",\"dateModified\":\"2024-11-01T11:02:25+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/atmokpo.com\/w\/37515\/\"},\"wordCount\":466,\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"articleSection\":[\"UWP Programming\"],\"inLanguage\":\"ko-KR\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/atmokpo.com\/w\/37515\/\",\"url\":\"https:\/\/atmokpo.com\/w\/37515\/\",\"name\":\"UWP Development, Developing SimpleDataGrid App - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#website\"},\"datePublished\":\"2024-11-01T09:58:11+00:00\",\"dateModified\":\"2024-11-01T11:02:25+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/atmokpo.com\/w\/37515\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/atmokpo.com\/w\/37515\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/atmokpo.com\/w\/37515\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\ud648\",\"item\":\"https:\/\/atmokpo.com\/w\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"UWP Development, Developing SimpleDataGrid App\"}]},{\"@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, Developing SimpleDataGrid App - \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\/37515\/","og_locale":"ko_KR","og_type":"article","og_title":"UWP Development, Developing SimpleDataGrid App - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","og_description":"UWP (Universal Windows Platform) is a platform for developing applications that can be used on Windows 10 and later versions. By using UWP, you can create a single application that runs on a variety of Windows devices. In this article, we will take a closer look at how to develop a SimpleDataGrid application using UWP. &hellip; \ub354 \ubcf4\uae30 \"UWP Development, Developing SimpleDataGrid App\"","og_url":"https:\/\/atmokpo.com\/w\/37515\/","og_site_name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","article_published_time":"2024-11-01T09:58:11+00:00","article_modified_time":"2024-11-01T11:02:25+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\/37515\/#article","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/37515\/"},"author":{"name":"root","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7"},"headline":"UWP Development, Developing SimpleDataGrid App","datePublished":"2024-11-01T09:58:11+00:00","dateModified":"2024-11-01T11:02:25+00:00","mainEntityOfPage":{"@id":"https:\/\/atmokpo.com\/w\/37515\/"},"wordCount":466,"publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"articleSection":["UWP Programming"],"inLanguage":"ko-KR"},{"@type":"WebPage","@id":"https:\/\/atmokpo.com\/w\/37515\/","url":"https:\/\/atmokpo.com\/w\/37515\/","name":"UWP Development, Developing SimpleDataGrid App - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/#website"},"datePublished":"2024-11-01T09:58:11+00:00","dateModified":"2024-11-01T11:02:25+00:00","breadcrumb":{"@id":"https:\/\/atmokpo.com\/w\/37515\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/atmokpo.com\/w\/37515\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/atmokpo.com\/w\/37515\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\ud648","item":"https:\/\/atmokpo.com\/w\/en\/"},{"@type":"ListItem","position":2,"name":"UWP Development, Developing SimpleDataGrid App"}]},{"@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\/37515","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=37515"}],"version-history":[{"count":1,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/37515\/revisions"}],"predecessor-version":[{"id":37516,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/37515\/revisions\/37516"}],"wp:attachment":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/media?parent=37515"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/categories?post=37515"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/tags?post=37515"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}