Yet another blog about WPF, Surface, SL, MVVM, NUI.... - Tag - Windows Presentation Foundation http://blog.lexique-du-net.com/index.php? In this blog we talk about WPF, Natural User Interface(NUI), Microsoft Surface, WIndows 7, Multitouch, Touchless, JavaFX, MVVM, patterns, tips, tricks .... and a lot of other things ! en Mon, 26 Feb 2024 15:40:43 +0100 Jonathan ANTOINE, All rights reserved http://blogs.law.harvard.edu/tech/rss Dotclear What ? Dynamic resources creates Memory leaks in WPF 3.5 (SP1) ??? http://blog.lexique-du-net.com/index.php?post/2011/03/27/What-Dynamic-resources-creates-Memory-leaks-in-WPF-3.5-%28SP1%29 urn:md5:20f78de56ffc9f29719df87fb78511c5 Sun, 27 Mar 2011 08:12:00 +0200 JonathanANTOINE@falsemail.com WPF DynamicleakmemoryperformanceResourcestipstrickWindows Presentation FoundationWPF <p style="margin-top: 0; ">Everyone is told to not use DynamicResource during its childhood in WPF-(wonder)land. They are simply evil and they kill the app performance. Sometimes, we fall in the dark side of the force and use them effectively to be sure that the application will follow the trend and suits itself well. This is not as bad as it seems and it is in fact sometimes necessary and wanted.</p> <p>&nbsp;But today, while I was trying to improve the performance and the memory usage of a WPF application I work on, I discovered that they were also creating memory leaks! I felt betrayed. I was using them and they put a knife in my back while I trusted them to be useful.&nbsp;</p> <p><br /><strong>In this post we will see how it can happens, and how to solve this (little) issue.</strong></p> <p>I was not alone in this situation and I found out that there were both a work-around and an hotfix available. Here is the information I gathered.   Description of the problem When you create and load a ResourceDictionary, the objects you add inside are actually not created immediately. They are referenced in the form of an instance of an object... <a href="http://blog.lexique-du-net.com/index.php?post/2011/03/27/What-Dynamic-resources-creates-Memory-leaks-in-WPF-3.5-%28SP1%29"><em>Read</em> What ? Dynamic resources creates Memory leaks in WPF 3.5 (SP1) ???</a></p> http://blog.lexique-du-net.com/index.php?post/2011/03/27/What-Dynamic-resources-creates-Memory-leaks-in-WPF-3.5-%28SP1%29#comment-form http://blog.lexique-du-net.com/index.php?post/2011/03/27/What-Dynamic-resources-creates-Memory-leaks-in-WPF-3.5-%28SP1%29#comment-form http://feeds.feedburner.com/JonathanAntoine/comments/74 UIAutomation, Coded UI tests, AutomationPeer and WPF/silverlight custom controls http://blog.lexique-du-net.com/index.php?post/2011/03/23/UIAutomation%2C-Coded-UI-tests%2C-AutomationPeer-and-WPF-custom-controls urn:md5:629820d459b6479cd3dee0084d2f3179 Thu, 24 Mar 2011 00:04:00 +0100 JonathanANTOINE@falsemail.com WPF AutomationCoded UI TestsSilverlighttesttestingtestsWindows Presentation FoundationWPF <p style="margin-top: 0; ">The Coded UI Tests, available in Visual Studio Ultimate or Premium, enable the creation of automated tests for the User Interface. This is a really nice feature because you are no more forced to make "hand made" tests which takes hours to be performed.&nbsp;</p> <p style="margin-top: 0; ">The WPF controls in the framework are ready to be used by the Microsoft UI Automation which is itself used by the coded UI tests. This means that when you use the screen recorder to record the tests on your UI, it will be able to find the several control used in your application.</p> <p>When you create you own custom controls or extend standard one, the recorder would not be able to find them at first and so a whole part of the screen may not be available for tests. Actually, it is possible to record a test but every steps will be done using screen position: click at (120,30), drag from (120,30) to (10,40). This is really annoying because any changes in the UI may broke all your tests.</p> <p><br /><strong>In this post, we will see how to make a custom control fully useable in Coded UI tests scenarii. We will so answer the question "Why cannot the code UI test recorder find anything inside my WPF or Silverlight custom control ?"</strong></p> <p><strong><br /></strong></p> <p>Note: the same technique is used by the accessibility clients and by enabling this feature you also ease the people using your application through UI automation client like the partially-sighted person.</p> <p>How it works Everything is based on a class named AutomationPeer. When an UI Automation client analyzes your User Interface, it looks for an automation peer and uses it to walks trough the tree of peers. The tree of peers is nearly a visual tree but it exposes only the relevant part of the interface.  Every standard controls have a regarding... <a href="http://blog.lexique-du-net.com/index.php?post/2011/03/23/UIAutomation%2C-Coded-UI-tests%2C-AutomationPeer-and-WPF-custom-controls"><em>Read</em> UIAutomation, Coded UI tests, AutomationPeer and WPF/silverlight custom controls</a></p> http://blog.lexique-du-net.com/index.php?post/2011/03/23/UIAutomation%2C-Coded-UI-tests%2C-AutomationPeer-and-WPF-custom-controls#comment-form http://blog.lexique-du-net.com/index.php?post/2011/03/23/UIAutomation%2C-Coded-UI-tests%2C-AutomationPeer-and-WPF-custom-controls#comment-form http://feeds.feedburner.com/JonathanAntoine/comments/72 Introducing the amazing WPF controls library on Codeplex ! http://blog.lexique-du-net.com/index.php?post/2010/10/25/Introducing-the-amazing-WPF-controls-library-on-Codeplex-%21 urn:md5:38e0ac0a863f442767c1a2a1d9bf3431 Mon, 25 Oct 2010 01:19:00 +0200 JonathanANTOINE@falsemail.com WPF controlsdemoexampleWindows Presentation FoundationWPF <p>Hello everyone,   I am pleased to announce you the creation of the Amazing WPF controls library on Codeplex ! It will contains the differents controls I describe and/or peel on this blog. I will try to make an article for each control added to the library.   Here is a list of the currently available controls : An headered control (the one... <a href="http://blog.lexique-du-net.com/index.php?post/2010/10/25/Introducing-the-amazing-WPF-controls-library-on-Codeplex-%21"><em>Read</em> Introducing the amazing WPF controls library on Codeplex !</a></p> http://blog.lexique-du-net.com/index.php?post/2010/10/25/Introducing-the-amazing-WPF-controls-library-on-Codeplex-%21#comment-form http://blog.lexique-du-net.com/index.php?post/2010/10/25/Introducing-the-amazing-WPF-controls-library-on-Codeplex-%21#comment-form http://feeds.feedburner.com/JonathanAntoine/comments/63 How to create an hand writing to text control (ink recognizer) http://blog.lexique-du-net.com/index.php?post/2010/09/19/How-to-create-an-hand-writing-to-text-control-%28ink-recognizer%29 urn:md5:f9aea256e97acb32c48044cd92d26be4 Mon, 25 Oct 2010 00:01:00 +0200 JonathanANTOINE@falsemail.com MultiTouch apicontrolscustomdemohow tohow-tomanipulationmathmultitouchNatural User InterfacesampleTemplatetesttestingteststipstrickWindows Presentation FoundationWPFXAML <p>When building a (multi)touch application you may need one nice feature : translate hand-written text to real words. This open a whole new world full of possibilities like starting some actions when keywords are recognized or simply allow the users to write some text for later use.&nbsp;<br /><br /><strong>In this post we'll see all the step to create an hand writing to text control and how to tune it.</strong></p> <p>Specifications The HandWritingToText controls translate the text written with it's hand by the user into "computer text". The final purpose is to triggers some actions when a specific keyword is recognized and it'll so be able to recognize only one word at a time and not a whole text.   The recognized text will be published via an event and... <a href="http://blog.lexique-du-net.com/index.php?post/2010/09/19/How-to-create-an-hand-writing-to-text-control-%28ink-recognizer%29"><em>Read</em> How to create an hand writing to text control (ink recognizer)</a></p> http://blog.lexique-du-net.com/index.php?post/2010/09/19/How-to-create-an-hand-writing-to-text-control-%28ink-recognizer%29#comment-form http://blog.lexique-du-net.com/index.php?post/2010/09/19/How-to-create-an-hand-writing-to-text-control-%28ink-recognizer%29#comment-form http://feeds.feedburner.com/JonathanAntoine/comments/55 Migrate the Jetpack theme from Silverlight to WPF http://blog.lexique-du-net.com/index.php?post/2010/10/14/Migrate-the-Jetpack-theme-from-Silverlight-to-WPF urn:md5:b8f2e7c8b33b26254f7cc2e5daca903a Thu, 14 Oct 2010 12:54:00 +0200 JonathanANTOINE@falsemail.com WPF MigrationSilverlightThemeWindows Presentation FoundationWPFXAML <p>There is a great theme named Jetpack available for Silverlight applications which can be found on the Tim Heuer web site. I was wondering if it can be used in WPF applications and the answer is yes ! Here are the modifications I had to do to make all this work :   SelectionBackground replace by SelectionBrush (except for the DatePicker) I... <a href="http://blog.lexique-du-net.com/index.php?post/2010/10/14/Migrate-the-Jetpack-theme-from-Silverlight-to-WPF"><em>Read</em> Migrate the Jetpack theme from Silverlight to WPF</a></p> http://blog.lexique-du-net.com/index.php?post/2010/10/14/Migrate-the-Jetpack-theme-from-Silverlight-to-WPF#comment-form http://blog.lexique-du-net.com/index.php?post/2010/10/14/Migrate-the-Jetpack-theme-from-Silverlight-to-WPF#comment-form http://feeds.feedburner.com/JonathanAntoine/comments/61 How to create your own control library (how-to + tips) http://blog.lexique-du-net.com/index.php?post/2010/10/04/How-to-create-your-own-control-library urn:md5:9ed22011e4c8dd030431d70034af0342 Sun, 03 Oct 2010 23:27:00 +0200 JonathanANTOINE@falsemail.com WPF BindingContentControlcontrolscustomdataBindingDataTemplateDependencyPropertyeventsexamplehow tohow-toLibrarysampleTemplatetipstrickWindows Presentation FoundationWPFXAML <p>Reusability and factorizing are maybe the most commons things you want and use when you are developing applications. In WPF it often means creating controls library (i don’t mean UserControl) that will be easy to use in multiple applications. In this post we'll see all the step to create a control library useable in differents projects. The... <a href="http://blog.lexique-du-net.com/index.php?post/2010/10/04/How-to-create-your-own-control-library"><em>Read</em> How to create your own control library (how-to + tips)</a></p> http://blog.lexique-du-net.com/index.php?post/2010/10/04/How-to-create-your-own-control-library#comment-form http://blog.lexique-du-net.com/index.php?post/2010/10/04/How-to-create-your-own-control-library#comment-form http://feeds.feedburner.com/JonathanAntoine/comments/59 How to create an animated expander http://blog.lexique-du-net.com/index.php?post/2010/09/21/Create-an-animated-expander urn:md5:2ae908d20a12760560980c024eaabac7 Tue, 21 Sep 2010 14:02:00 +0200 JonathanANTOINE@falsemail.com WPF animationContentControlexamplesamplescalescalingTemplatetipstrickWindows Presentation FoundationWPFXAML <p>The expander control can be used in a lot of situations but the one proposed by default is quite "rigid". In this post we will discover how to animate it quite simply just via XAML ! The WPF engine lets us redefine the template of the controls and we'll just do that. The goal aimed What we aim is to get the same functionnality as the... <a href="http://blog.lexique-du-net.com/index.php?post/2010/09/21/Create-an-animated-expander"><em>Read</em> How to create an animated expander</a></p> http://blog.lexique-du-net.com/index.php?post/2010/09/21/Create-an-animated-expander#comment-form http://blog.lexique-du-net.com/index.php?post/2010/09/21/Create-an-animated-expander#comment-form http://feeds.feedburner.com/JonathanAntoine/comments/56 UserControl/Control : how to get a reference to an element of the template http://blog.lexique-du-net.com/index.php?post/2010/09/14/UserControl/Control-how-to-get-a-reference-to-an-element-of-the-template urn:md5:31729ab6c8a50b35686f1411e6c53daa Tue, 14 Sep 2010 22:42:00 +0200 JonathanANTOINE@falsemail.com WPF ContentControlcontrolscustomDataTemplateexceptionhow tohow-toTemplateWindows Presentation FoundationWPFXAML <p>When you want to create your own custom control you have two choices : create an UserControl or inherit from one of the "Control's classes" (ContentControl, ItemsControls or Control itself). When doing so, you'll surely need to access to the visual parts of your template from the code to add to it a nice behavior. In this post, we'll discover how... <a href="http://blog.lexique-du-net.com/index.php?post/2010/09/14/UserControl/Control-how-to-get-a-reference-to-an-element-of-the-template"><em>Read</em> UserControl/Control : how to get a reference to an element of the template</a></p> http://blog.lexique-du-net.com/index.php?post/2010/09/14/UserControl/Control-how-to-get-a-reference-to-an-element-of-the-template#comment-form http://blog.lexique-du-net.com/index.php?post/2010/09/14/UserControl/Control-how-to-get-a-reference-to-an-element-of-the-template#comment-form http://feeds.feedburner.com/JonathanAntoine/comments/54 Execute a command on a specified control when clicking on a button http://blog.lexique-du-net.com/index.php?post/2010/06/16/Execute-a-command-on-a-specified-control-when-clicking-on-a-button urn:md5:d120a96b6da17f34e9dcdd2044d853d9 Wed, 16 Jun 2010 15:07:00 +0200 JonathanANTOINE@falsemail.com WPF AttachedPropertyBindingdataBindingDependencyObjectDependencyPropertyeventsexamplehow tohow-toM-V-VMMouseEventMVVMOnPropertyChangedpatternpatternssampletipstrickWindows Presentation FoundationWPFXAML <p>Today another example of the powerful ramora pattern : execute a RoutedCommand on an Control when you click on a button outside of the aimed control scope. When is it useful ? : for example when you use the infragistics grid (xamdatagrid) and you want to execute the command which remove the selected row from a button outside of the grid. You... <a href="http://blog.lexique-du-net.com/index.php?post/2010/06/16/Execute-a-command-on-a-specified-control-when-clicking-on-a-button"><em>Read</em> Execute a command on a specified control when clicking on a button</a></p> http://blog.lexique-du-net.com/index.php?post/2010/06/16/Execute-a-command-on-a-specified-control-when-clicking-on-a-button#comment-form http://blog.lexique-du-net.com/index.php?post/2010/06/16/Execute-a-command-on-a-specified-control-when-clicking-on-a-button#comment-form http://feeds.feedburner.com/JonathanAntoine/comments/52 Binding to the selected items of a ListBox (or an another items controls) http://blog.lexique-du-net.com/index.php?post/2010/06/13/Binding-to-the-selected-items-of-a-ListBox urn:md5:04ab1651e48f6d69d4b3c1afa893f976 Sun, 13 Jun 2010 12:03:00 +0200 JonathanANTOINE@falsemail.com WPF AttachedPropertyBindingdataBindingDependencyObjectDependencyPropertyDesign patterneventshow tohow-toListBoxM-V-VMMVVMpatternpatternssampleSelectedItemstipstrickWindows Presentation FoundationWPFXAML <p>A problem you often meet when using MVVM is to get the selected items of an items control, especially Listbox. You can easily bind the selected item or the current items but when multi selection comes in the way, it becomes harder because the SelectedItems (with an 's' property is not available to binding). In this article we will discover an... <a href="http://blog.lexique-du-net.com/index.php?post/2010/06/13/Binding-to-the-selected-items-of-a-ListBox"><em>Read</em> Binding to the selected items of a ListBox (or an another items controls)</a></p> http://blog.lexique-du-net.com/index.php?post/2010/06/13/Binding-to-the-selected-items-of-a-ListBox#comment-form http://blog.lexique-du-net.com/index.php?post/2010/06/13/Binding-to-the-selected-items-of-a-ListBox#comment-form http://feeds.feedburner.com/JonathanAntoine/comments/51 [Performance tips] Use the system shadows instead of your own http://blog.lexique-du-net.com/index.php?post/2010/04/27/Performance-tips-Use-the-system-shadows-instead-of-your-own urn:md5:6ce9a6fcf6a9fa653286c4c02a507fc7 Tue, 27 Apr 2010 23:52:00 +0200 JonathanANTOINE@falsemail.com WPF aerodemoexamplehow tohow-toperformanceshadowshadowstipstrickWindows Presentation FoundationWPFXAML <p>Today a fast and easy tip about shadows and performance. In a project I have recently made, we've told the designer not to use BitmapEffects because they are performance killer. He so decided to create it's own shadows by duplicating each shape and make them looks like shadows(designer magic, voodoo things, etc...). I was then surprised to see... <a href="http://blog.lexique-du-net.com/index.php?post/2010/04/27/Performance-tips-Use-the-system-shadows-instead-of-your-own"><em>Read</em> [Performance tips] Use the system shadows instead of your own</a></p> http://blog.lexique-du-net.com/index.php?post/2010/04/27/Performance-tips-Use-the-system-shadows-instead-of-your-own#comment-form http://blog.lexique-du-net.com/index.php?post/2010/04/27/Performance-tips-Use-the-system-shadows-instead-of-your-own#comment-form http://feeds.feedburner.com/JonathanAntoine/comments/50 Freeze brushes directly in the XAML to improve your application's performances http://blog.lexique-du-net.com/index.php?post/2010/04/12/Freeze-brushes-directly-in-the-XAML-to-improve-your-application-s-performances urn:md5:9e20a96580288c5ab39762cf98c5d356 Mon, 12 Apr 2010 22:53:00 +0200 JonathanANTOINE@falsemail.com WPF examplefreezehow tohow-toperformancetipstrickWindows Presentation FoundationWPFXAML <p>When you read the MSDN guidelines to improve WPF's performances you can find that it's a good idea to freeze Freezable objects. It's a quite easy thing to do via the code but it's quite harder to do it directly in the XAML. In this post we will see how to do so. What are freezable objects One upon a time, the MSDN said : A Freezable is a... <a href="http://blog.lexique-du-net.com/index.php?post/2010/04/12/Freeze-brushes-directly-in-the-XAML-to-improve-your-application-s-performances"><em>Read</em> Freeze brushes directly in the XAML to improve your application's performances</a></p> http://blog.lexique-du-net.com/index.php?post/2010/04/12/Freeze-brushes-directly-in-the-XAML-to-improve-your-application-s-performances#comment-form http://blog.lexique-du-net.com/index.php?post/2010/04/12/Freeze-brushes-directly-in-the-XAML-to-improve-your-application-s-performances#comment-form http://feeds.feedburner.com/JonathanAntoine/comments/49 Simple properties Mapper by reflection : stop copying manually each property of your objects ! http://blog.lexique-du-net.com/index.php?post/2010/04/08/Simple-properties-Mapper-by-reflection urn:md5:c953a7caee3d6372fc5d0b3b3150e49b Thu, 08 Apr 2010 23:14:00 +0200 JonathanANTOINE@falsemail.com .NET demoexamplehow tohow-totipstrickWCFWindows Presentation FoundationWPF <p>There is time when you have to copy each property of an object to one another. This is called mapping and it's very fastidious to do it by hand. In this post we'll see how to create a method extension which do it for you in one line of code ! When can it be useful Here is a non exhaustive list of usage you can find to this snippet: You want... <a href="http://blog.lexique-du-net.com/index.php?post/2010/04/08/Simple-properties-Mapper-by-reflection"><em>Read</em> Simple properties Mapper by reflection : stop copying manually each property of your objects !</a></p> http://blog.lexique-du-net.com/index.php?post/2010/04/08/Simple-properties-Mapper-by-reflection#comment-form http://blog.lexique-du-net.com/index.php?post/2010/04/08/Simple-properties-Mapper-by-reflection#comment-form http://feeds.feedburner.com/JonathanAntoine/comments/48