{"id":37705,"date":"2024-11-01T09:59:45","date_gmt":"2024-11-01T09:59:45","guid":{"rendered":"http:\/\/atmokpo.com\/w\/?p=37705"},"modified":"2024-11-01T11:04:04","modified_gmt":"2024-11-01T11:04:04","slug":"wpf-development-transformation","status":"publish","type":"post","link":"https:\/\/atmokpo.com\/w\/37705\/","title":{"rendered":"WPF Development, Transformation"},"content":{"rendered":"<p><body><\/p>\n<p>WPF (Windows Presentation Foundation) is a powerful tool for creating desktop applications. It allows users to build diverse user interfaces in both mobile and desktop environments. WPF is based on XAML (Extensible Application Markup Language) and supports features such as data binding, styling, templates, and animations. In this article, we will explore the concept of &#8216;Transformations&#8217; in WPF. Transformations are useful for manipulating the position, size, and rotation of UI elements to create various visual effects.<\/p>\n<h2>1. Concept of Transform<\/h2>\n<p>Transformations are necessary techniques for changing the visual representation of UI elements in WPF. They are primarily divided into three types:<\/p>\n<ul>\n<li><strong>Move:<\/strong> Moves the UI element to a specified position.<\/li>\n<li><strong>Rotate:<\/strong> Rotates the UI element by a specified angle.<\/li>\n<li><strong>Scale:<\/strong> Adjusts the size of the UI element.<\/li>\n<\/ul>\n<p>Transformations can be applied directly to UI elements, enabling users to enhance the visual representation of their applications. Transformations are typically implemented using the <code>RenderTransform<\/code> and <code>LayoutTransform<\/code> properties.<\/p>\n<h2>2. Implementing Transformations<\/h2>\n<p>The easiest way to implement transformations is by using XAML. For example, let&#8217;s apply a transformation that moves a simple rectangle.<\/p>\n<h3>2.1 Implementing a Simple Move Transformation with XAML<\/h3>\n<p>The following is an example of XAML code for a WPF application. This code includes a transformation that moves the rectangle:<\/p>\n<pre>\n        <code>&lt;Window x:Class=\"WpfApp.MainWindow\"\n                xmlns=\"http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml\/presentation\"\n                xmlns:x=\"http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml\"\n                Title=\"Transform Example\" Height=\"350\" Width=\"525\"&gt;\n            &lt;Grid&gt;\n                &lt;Rectangle Width=\"100\" Height=\"100\" Fill=\"Blue\"&gt;\n                    &lt;Rectangle.RenderTransform&gt;\n                        &lt;TranslateTransform X=\"50\" Y=\"50\"\/&gt;\n                    &lt;\/Rectangle.RenderTransform&gt;\n                &lt;\/Rectangle&gt;\n            &lt;\/Grid&gt;\n        &lt;\/Window&gt;<\/code>\n    <\/pre>\n<p>In the example above, the rectangle is drawn on the screen after moving (50, 50) from its original position. The movement along the X and Y axes is defined using <code>TranslateTransform<\/code>.<\/p>\n<h3>2.2 Implementing a Rotation Transformation<\/h3>\n<p>Now, let&#8217;s look at an example that rotates a rectangle. The following code rotates the rectangle by 45 degrees:<\/p>\n<pre>\n        <code>&lt;Rectangle Width=\"100\" Height=\"100\" Fill=\"Green\"&gt;\n            &lt;Rectangle.RenderTransform&gt;\n                &lt;RotateTransform Angle=\"45\"\/&gt;\n            &lt;\/Rectangle.RenderTransform&gt;\n        &lt;\/Rectangle&gt;<\/code>\n    <\/pre>\n<p>Here, <code>RotateTransform<\/code> is used to rotate the rectangle by 45 degrees. The rotation transformation effectively represents the rotation of the UI element visually.<\/p>\n<h3>2.3 Implementing a Scale Transformation<\/h3>\n<p>Let&#8217;s see an example of scaling the rectangle. The following code doubles the size of the rectangle:<\/p>\n<pre>\n        <code>&lt;Rectangle Width=\"100\" Height=\"100\" Fill=\"Red\"&gt;\n            &lt;Rectangle.RenderTransform&gt;\n                &lt;ScaleTransform ScaleX=\"2\" ScaleY=\"2\"\/&gt;\n            &lt;\/Rectangle.RenderTransform&gt;\n        &lt;\/Rectangle&gt;<\/code>\n    <\/pre>\n<p>In this example, <code>ScaleTransform<\/code> is used to double the size of the rectangle. By adjusting the <code>ScaleX<\/code> and <code>ScaleY<\/code> properties, the scale for the X and Y axes can be set respectively.<\/p>\n<h2>3. Transformations Through Animation<\/h2>\n<p>In WPF, transformations can be combined with animations to create even more powerful visual effects. Below is an example that implements an animation for moving a rectangle.<\/p>\n<h3>3.1 Example of Move Animation<\/h3>\n<p>The following is an example of adding animation in WPF XAML:<\/p>\n<pre>\n        <code>&lt;Window x:Class=\"WpfApp.MainWindow\"\n                xmlns=\"http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml\/presentation\"\n                xmlns:x=\"http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml\"\n                Title=\"Transform Animation\" Height=\"350\" Width=\"525\"&gt;\n            &lt;Window.Resources&gt;\n                &lt;Storyboard x:Key=\"MoveAnimation\"&gt;\n                    &lt;DoubleAnimation Storyboard.TargetName=\"AnimatedRectangle\"\n                                     Storyboard.TargetProperty=\"(UIElement.RenderTransform).(TranslateTransform.X)\"\n                                     From=\"0\" To=\"100\" Duration=\"0:0:1\" AutoReverse=\"True\" RepeatBehavior=\"Forever\"\/&gt;\n                &lt;\/Storyboard&gt;\n            &lt;\/Window.Resources&gt;\n            &lt;Grid&gt;\n                &lt;Rectangle x:Name=\"AnimatedRectangle\" Width=\"100\" Height=\"100\" Fill=\"Blue\" MouseDown=\"Rectangle_MouseDown\"&gt;\n                    &lt;Rectangle.RenderTransform&gt;\n                        &lt;TranslateTransform X=\"0\" Y=\"0\"\/&gt;\n                    &lt;\/Rectangle.RenderTransform&gt;\n                &lt;\/Rectangle&gt;\n            &lt;\/Grid&gt;\n        &lt;\/Window&gt;<\/code>\n    <\/pre>\n<p>In the above code, <code>Storyboard<\/code> is used to specify the animation for the X transformation of the rectangle. To make the animation start on mouse button click, the corresponding method can be implemented in the code-behind.<\/p>\n<h4>3.2 Code-Behind (C#) Example<\/h4>\n<pre>\n        <code>private void Rectangle_MouseDown(object sender, MouseButtonEventArgs e)\n        {\n            Storyboard moveAnimation = (Storyboard)this.Resources[\"MoveAnimation\"];\n            moveAnimation.Begin();\n        }<\/code>\n    <\/pre>\n<p>This method starts the animation when the rectangle is clicked.<\/p>\n<h2>4. Conclusion<\/h2>\n<p>In this article, we explored how to utilize transformations in WPF. Transformations play an essential role in providing visually appealing effects to users by adjusting the position, rotation, and size of UI elements. By leveraging WPF transformation features, it becomes easier to create intricate UIs and enhance the overall user experience of applications.<\/p>\n<p>Properly utilizing transformations in WPF development can make user interactions more engaging and provide visual feedback. Combine various transformation techniques and animations to create your unique UI.<\/p>\n<p><\/body><\/p>\n","protected":false},"excerpt":{"rendered":"<p>WPF (Windows Presentation Foundation) is a powerful tool for creating desktop applications. It allows users to build diverse user interfaces in both mobile and desktop environments. WPF is based on XAML (Extensible Application Markup Language) and supports features such as data binding, styling, templates, and animations. In this article, we will explore the concept of &hellip; <a href=\"https:\/\/atmokpo.com\/w\/37705\/\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;WPF Development, Transformation&#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-37705","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, Transformation - \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\/37705\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"WPF Development, Transformation - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"og:description\" content=\"WPF (Windows Presentation Foundation) is a powerful tool for creating desktop applications. It allows users to build diverse user interfaces in both mobile and desktop environments. WPF is based on XAML (Extensible Application Markup Language) and supports features such as data binding, styling, templates, and animations. In this article, we will explore the concept of &hellip; \ub354 \ubcf4\uae30 &quot;WPF Development, Transformation&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/atmokpo.com\/w\/37705\/\" \/>\n<meta property=\"og:site_name\" content=\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-01T09:59:45+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-01T11:04:04+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=\"4\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/atmokpo.com\/w\/37705\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/37705\/\"},\"author\":{\"name\":\"root\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\"},\"headline\":\"WPF Development, Transformation\",\"datePublished\":\"2024-11-01T09:59:45+00:00\",\"dateModified\":\"2024-11-01T11:04:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/atmokpo.com\/w\/37705\/\"},\"wordCount\":504,\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"articleSection\":[\"WPF Programming\"],\"inLanguage\":\"ko-KR\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/atmokpo.com\/w\/37705\/\",\"url\":\"https:\/\/atmokpo.com\/w\/37705\/\",\"name\":\"WPF Development, Transformation - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#website\"},\"datePublished\":\"2024-11-01T09:59:45+00:00\",\"dateModified\":\"2024-11-01T11:04:04+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/atmokpo.com\/w\/37705\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/atmokpo.com\/w\/37705\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/atmokpo.com\/w\/37705\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\ud648\",\"item\":\"https:\/\/atmokpo.com\/w\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"WPF Development, Transformation\"}]},{\"@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, Transformation - \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\/37705\/","og_locale":"ko_KR","og_type":"article","og_title":"WPF Development, Transformation - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","og_description":"WPF (Windows Presentation Foundation) is a powerful tool for creating desktop applications. It allows users to build diverse user interfaces in both mobile and desktop environments. WPF is based on XAML (Extensible Application Markup Language) and supports features such as data binding, styling, templates, and animations. In this article, we will explore the concept of &hellip; \ub354 \ubcf4\uae30 \"WPF Development, Transformation\"","og_url":"https:\/\/atmokpo.com\/w\/37705\/","og_site_name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","article_published_time":"2024-11-01T09:59:45+00:00","article_modified_time":"2024-11-01T11:04:04+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":"4\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/atmokpo.com\/w\/37705\/#article","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/37705\/"},"author":{"name":"root","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7"},"headline":"WPF Development, Transformation","datePublished":"2024-11-01T09:59:45+00:00","dateModified":"2024-11-01T11:04:04+00:00","mainEntityOfPage":{"@id":"https:\/\/atmokpo.com\/w\/37705\/"},"wordCount":504,"publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"articleSection":["WPF Programming"],"inLanguage":"ko-KR"},{"@type":"WebPage","@id":"https:\/\/atmokpo.com\/w\/37705\/","url":"https:\/\/atmokpo.com\/w\/37705\/","name":"WPF Development, Transformation - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/#website"},"datePublished":"2024-11-01T09:59:45+00:00","dateModified":"2024-11-01T11:04:04+00:00","breadcrumb":{"@id":"https:\/\/atmokpo.com\/w\/37705\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/atmokpo.com\/w\/37705\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/atmokpo.com\/w\/37705\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\ud648","item":"https:\/\/atmokpo.com\/w\/en\/"},{"@type":"ListItem","position":2,"name":"WPF Development, Transformation"}]},{"@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\/37705","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=37705"}],"version-history":[{"count":1,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/37705\/revisions"}],"predecessor-version":[{"id":37706,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/37705\/revisions\/37706"}],"wp:attachment":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/media?parent=37705"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/categories?post=37705"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/tags?post=37705"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}