{"id":37731,"date":"2024-11-01T09:59:57","date_gmt":"2024-11-01T09:59:57","guid":{"rendered":"http:\/\/atmokpo.com\/w\/?p=37731"},"modified":"2024-11-01T11:03:58","modified_gmt":"2024-11-01T11:03:58","slug":"wpf-development-practice-discussion-page-creation","status":"publish","type":"post","link":"https:\/\/atmokpo.com\/w\/37731\/","title":{"rendered":"WPF Development, Practice Discussion Page Creation"},"content":{"rendered":"<p>\n    WPF (Windows Presentation Foundation) is a very useful technology for designing and developing Windows applications. In this tutorial, we will learn how to create a simple discussion page using WPF. This tutorial will cover the basic concepts of WPF, along with practical projects utilizing data binding, event handling, custom controls, and the MVVM (Model-View-ViewModel) pattern.\n<\/p>\n<h2>1. What is WPF?<\/h2>\n<p>\n    WPF is a UI framework developed by Microsoft, based on the .NET Framework. With WPF, you can easily and quickly create advanced user interfaces, and develop visually appealing applications with vector graphics, styling, and templating features.\n<\/p>\n<h2>2. Key Features of WPF<\/h2>\n<ul>\n<li>XAML (Extensible Application Markup Language) based UI design<\/li>\n<li>Efficient UI work through data binding<\/li>\n<li>Improved code separation and maintainability through the MVVM pattern<\/li>\n<li>Various multimedia capabilities including 3D graphics and animations<\/li>\n<li>Support for effective collaboration between design and development<\/li>\n<\/ul>\n<h2>3. Designing the Discussion Page<\/h2>\n<p>\n    In this project, we will design a discussion page with the following features.\n<\/p>\n<ul>\n<li>A text box where users can enter their opinions<\/li>\n<li>When the submit button is clicked, the opinion is added to the list<\/li>\n<li>A button to delete submitted opinions<\/li>\n<\/ul>\n<h2>4. Project Setup<\/h2>\n<p>\n    Open Visual Studio and create a new WPF application project. Set the project name to &#8220;DiscussionPage&#8221;. You can design the UI in the automatically generated MainWindow.xaml file.\n<\/p>\n<h2>5. XAML UI Design<\/h2>\n<pre><code>\n&lt;Window x:Class=\"DiscussionPage.MainWindow\"\n        xmlns=\"http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml\/presentation\"\n        xmlns:x=\"http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml\"\n        Title=\"Discussion Page\" Height=\"450\" Width=\"800\"&gt;\n    &lt;Grid&gt;\n        &lt;Grid.RowDefinitions&gt;\n            &lt;RowDefinition Height=\"Auto\"\/&gt;\n            &lt;RowDefinition Height=\"*\"\/&gt;\n        &lt;\/Grid.RowDefinitions&gt;\n\n        &lt;StackPanel Orientation=\"Horizontal\"&gt;\n            &lt;TextBox x:Name=\"CommentTextBox\" Width=\"600\" Height=\"30\" Margin=\"10\" PlaceholderText=\"Enter your opinion...\" \/&gt;\n            &lt;Button x:Name=\"SubmitButton\" Content=\"Submit\" Width=\"80\" Height=\"30\" Click=\"SubmitButton_Click\" Margin=\"10\"\/&gt;\n        &lt;\/StackPanel&gt;\n\n        &lt;ListBox x:Name=\"CommentsListBox\" Grid.Row=\"1\" Margin=\"10\" \/&gt;\n    &lt;\/Grid&gt;\n&lt;\/Window&gt;\n<\/code><\/pre>\n<h2>6. Code Behind<\/h2>\n<p>\n    The UI is ready, so now we prepare to write C# code to handle user input. Write the following in the MainWindow.xaml.cs file.\n<\/p>\n<pre><code>\nusing System;\nusing System.Collections.ObjectModel;\nusing System.Windows;\n\nnamespace DiscussionPage\n{\n    public partial class MainWindow : Window\n    {\n        public ObservableCollection&lt;string&gt; Comments { get; set; }\n\n        public MainWindow()\n        {\n            InitializeComponent();\n            Comments = new ObservableCollection&lt;string&gt;();\n            CommentsListBox.ItemsSource = Comments;\n        }\n\n        private void SubmitButton_Click(object sender, RoutedEventArgs e)\n        {\n            if (!string.IsNullOrWhiteSpace(CommentTextBox.Text))\n            {\n                Comments.Add(CommentTextBox.Text);\n                CommentTextBox.Clear();\n            }\n            else\n            {\n                MessageBox.Show(\"Please enter your opinion.\", \"Warning\", MessageBoxButton.OK, MessageBoxImage.Warning);\n            }\n        }\n    }\n}\n<\/code><\/pre>\n<h2>7. Code Explanation<\/h2>\n<p>\n    The most important part of the above code is the use of <code>ObservableCollection<\/code> to perform data binding with the list box. When the user submits an opinion, the entered opinion is added to the list and reflected in the UI in real-time.\n<\/p>\n<h2>8. Feature Expansion &#8211; Adding Delete Functionality<\/h2>\n<p>\n    Let&#8217;s add a feature to delete the opinions registered by the users. We will add a button to remove the selected item from the list box.\n<\/p>\n<pre><code>\n&lt;Button x:Name=\"DeleteButton\" Content=\"Delete\" Width=\"80\" Height=\"30\" Click=\"DeleteButton_Click\" Margin=\"10\"\/&gt;\n<\/code><\/pre>\n<h2>9. Adding Delete Button Event Handler<\/h2>\n<pre><code>\nprivate void DeleteButton_Click(object sender, RoutedEventArgs e)\n{\n    string selectedComment = (string)CommentsListBox.SelectedItem;\n    if (selectedComment != null)\n    {\n        Comments.Remove(selectedComment);\n    }\n    else\n    {\n        MessageBox.Show(\"Please select an opinion to delete.\", \"Warning\", MessageBoxButton.OK, MessageBoxImage.Warning);\n    }\n}\n<\/code><\/pre>\n<h2>10. Final Check and Execution<\/h2>\n<p>\n    All the code and UI are complete. You can now run the project to test the implemented features. When a user enters an opinion and submits it, it will be added to the list, and the selected opinion can be deleted.\n<\/p>\n<h2>11. Additional Feature Considerations<\/h2>\n<p>\n    Now that the project has basic functionality, here are some additional features to consider:\n<\/p>\n<ul>\n<li>Comment feature for opinions<\/li>\n<li>Like feature for comments<\/li>\n<li>Adding a name field for the opinion writer<\/li>\n<li>API connections for extension to a web application<\/li>\n<\/ul>\n<h2>12. Conclusion<\/h2>\n<p>\n    In this tutorial, we created a simple discussion page using WPF. I hope it served as a great opportunity to learn the basic concepts of WPF, data binding, and the importance of event handling and the MVVM pattern.\n<\/p>\n<p>\n    I encourage you to expand your skills through more projects and practice with WPF. For example, this project could be improved and changed into a web application.\n<\/p>\n<p>\n    I look forward to your support and feedback. Good luck!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WPF (Windows Presentation Foundation) is a very useful technology for designing and developing Windows applications. In this tutorial, we will learn how to create a simple discussion page using WPF. This tutorial will cover the basic concepts of WPF, along with practical projects utilizing data binding, event handling, custom controls, and the MVVM (Model-View-ViewModel) pattern. &hellip; <a href=\"https:\/\/atmokpo.com\/w\/37731\/\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;WPF Development, Practice Discussion Page Creation&#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":[117],"tags":[],"class_list":["post-37731","post","type-post","status-publish","format-standard","hentry","category-wpf-programming"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>WPF Development, Practice Discussion Page Creation - \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\/37731\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"WPF Development, Practice Discussion Page Creation - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"og:description\" content=\"WPF (Windows Presentation Foundation) is a very useful technology for designing and developing Windows applications. In this tutorial, we will learn how to create a simple discussion page using WPF. This tutorial will cover the basic concepts of WPF, along with practical projects utilizing data binding, event handling, custom controls, and the MVVM (Model-View-ViewModel) pattern. &hellip; \ub354 \ubcf4\uae30 &quot;WPF Development, Practice Discussion Page Creation&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/atmokpo.com\/w\/37731\/\" \/>\n<meta property=\"og:site_name\" content=\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-01T09:59:57+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-01T11:03:58+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\/37731\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/37731\/\"},\"author\":{\"name\":\"root\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\"},\"headline\":\"WPF Development, Practice Discussion Page Creation\",\"datePublished\":\"2024-11-01T09:59:57+00:00\",\"dateModified\":\"2024-11-01T11:03:58+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/atmokpo.com\/w\/37731\/\"},\"wordCount\":491,\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"articleSection\":[\"WPF Programming\"],\"inLanguage\":\"ko-KR\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/atmokpo.com\/w\/37731\/\",\"url\":\"https:\/\/atmokpo.com\/w\/37731\/\",\"name\":\"WPF Development, Practice Discussion Page Creation - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#website\"},\"datePublished\":\"2024-11-01T09:59:57+00:00\",\"dateModified\":\"2024-11-01T11:03:58+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/atmokpo.com\/w\/37731\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/atmokpo.com\/w\/37731\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/atmokpo.com\/w\/37731\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\ud648\",\"item\":\"https:\/\/atmokpo.com\/w\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"WPF Development, Practice Discussion Page Creation\"}]},{\"@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":"WPF Development, Practice Discussion Page Creation - \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\/37731\/","og_locale":"ko_KR","og_type":"article","og_title":"WPF Development, Practice Discussion Page Creation - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","og_description":"WPF (Windows Presentation Foundation) is a very useful technology for designing and developing Windows applications. In this tutorial, we will learn how to create a simple discussion page using WPF. This tutorial will cover the basic concepts of WPF, along with practical projects utilizing data binding, event handling, custom controls, and the MVVM (Model-View-ViewModel) pattern. &hellip; \ub354 \ubcf4\uae30 \"WPF Development, Practice Discussion Page Creation\"","og_url":"https:\/\/atmokpo.com\/w\/37731\/","og_site_name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","article_published_time":"2024-11-01T09:59:57+00:00","article_modified_time":"2024-11-01T11:03:58+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\/37731\/#article","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/37731\/"},"author":{"name":"root","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7"},"headline":"WPF Development, Practice Discussion Page Creation","datePublished":"2024-11-01T09:59:57+00:00","dateModified":"2024-11-01T11:03:58+00:00","mainEntityOfPage":{"@id":"https:\/\/atmokpo.com\/w\/37731\/"},"wordCount":491,"publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"articleSection":["WPF Programming"],"inLanguage":"ko-KR"},{"@type":"WebPage","@id":"https:\/\/atmokpo.com\/w\/37731\/","url":"https:\/\/atmokpo.com\/w\/37731\/","name":"WPF Development, Practice Discussion Page Creation - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/#website"},"datePublished":"2024-11-01T09:59:57+00:00","dateModified":"2024-11-01T11:03:58+00:00","breadcrumb":{"@id":"https:\/\/atmokpo.com\/w\/37731\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/atmokpo.com\/w\/37731\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/atmokpo.com\/w\/37731\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\ud648","item":"https:\/\/atmokpo.com\/w\/en\/"},{"@type":"ListItem","position":2,"name":"WPF Development, Practice Discussion Page Creation"}]},{"@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\/37731","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=37731"}],"version-history":[{"count":1,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/37731\/revisions"}],"predecessor-version":[{"id":37732,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/37731\/revisions\/37732"}],"wp:attachment":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/media?parent=37731"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/categories?post=37731"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/tags?post=37731"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}