Yet another blog about WPF, Surface, SL, MVVM, NUI.... - Tag - WPF 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 Wed, 19 Jan 2022 22:42:19 +0100 Jonathan ANTOINE, All rights reserved Dotclear Amazing WPF Controls / JetPack Theme updated ! urn:md5:88ead68957a351bbe11ed3474c8ea2f3 Mon, 13 Jun 2011 13:56:00 +0200 WPF animationcontrolsnewsTemplateWPFXAML <p>Hello, I have updated my previously introduced control library on codeplex. I received a lot of comments because the jetPack theme was not working fine bacause of some animation. It is now fixed and I want to thank everyone for the feedback !__ Here are the list of the available updates: JetPack Theme is now building and working fine at... <a href=""><em>Read</em> Amazing WPF Controls / JetPack Theme updated !</a></p> What ? Dynamic resources creates Memory leaks in WPF 3.5 (SP1) ??? urn:md5:20f78de56ffc9f29719df87fb78511c5 Sun, 27 Mar 2011 08:12:00 +0200 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=""><em>Read</em> What ? Dynamic resources creates Memory leaks in WPF 3.5 (SP1) ???</a></p> UIAutomation, Coded UI tests, AutomationPeer and WPF/silverlight custom controls urn:md5:629820d459b6479cd3dee0084d2f3179 Thu, 24 Mar 2011 00:04:00 +0100 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=""><em>Read</em> UIAutomation, Coded UI tests, AutomationPeer and WPF/silverlight custom controls</a></p> Introducing the amazing WPF controls library on Codeplex ! urn:md5:38e0ac0a863f442767c1a2a1d9bf3431 Mon, 25 Oct 2010 01:19:00 +0200 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=""><em>Read</em> Introducing the amazing WPF controls library on Codeplex !</a></p> How to create an hand writing to text control (ink recognizer) urn:md5:f9aea256e97acb32c48044cd92d26be4 Mon, 25 Oct 2010 00:01:00 +0200 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=""><em>Read</em> How to create an hand writing to text control (ink recognizer)</a></p> Migrate the Jetpack theme from Silverlight to WPF urn:md5:b8f2e7c8b33b26254f7cc2e5daca903a Thu, 14 Oct 2010 12:54:00 +0200 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=""><em>Read</em> Migrate the Jetpack theme from Silverlight to WPF</a></p> How to create your own control library (how-to + tips) urn:md5:9ed22011e4c8dd030431d70034af0342 Sun, 03 Oct 2010 23:27:00 +0200 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=""><em>Read</em> How to create your own control library (how-to + tips)</a></p> WPF tip : How can I use static/dynamic resources in my tests urn:md5:4a3dab56d52a0b0385223e6db58a46ec Fri, 24 Sep 2010 12:33:00 +0200 WPF .NET4.0examplehow tohow-totesttestingtestsunitWPF <p>You are surely, as I am, creating a lot of units tests in your WPF applications. Some of the tests may use statics or dynamics resources declared in your application and when you launch the tests, all you get is an XamlParseException exception thrown. System.Windows.Markup.XamlParseException: 'Provide value on... <a href=""><em>Read</em> WPF tip : How can I use static/dynamic resources in my tests</a></p> How to create an animated expander urn:md5:2ae908d20a12760560980c024eaabac7 Tue, 21 Sep 2010 14:02:00 +0200 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=""><em>Read</em> How to create an animated expander</a></p> UserControl/Control : how to get a reference to an element of the template urn:md5:31729ab6c8a50b35686f1411e6c53daa Tue, 14 Sep 2010 22:42:00 +0200 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=""><em>Read</em> UserControl/Control : how to get a reference to an element of the template</a></p> .NET Framework 4, Windows Applications Development urn:md5:bc17957967d761091687b9b9694b2180 Thu, 24 Jun 2010 16:35:00 +0200 Other things .NET4.0certificationWPF <p>I am now certified " .NET Framework 4, Windows Applications Development". I passed the certification during the beta process and the results are out. I can now use this nice logo anywhere ^^ :... <a href=""><em>Read</em> .NET Framework 4, Windows Applications Development</a></p> Execute a command on a specified control when clicking on a button urn:md5:d120a96b6da17f34e9dcdd2044d853d9 Wed, 16 Jun 2010 15:07:00 +0200 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=""><em>Read</em> Execute a command on a specified control when clicking on a button</a></p> Binding to the selected items of a ListBox (or an another items controls) urn:md5:04ab1651e48f6d69d4b3c1afa893f976 Sun, 13 Jun 2010 12:03:00 +0200 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=""><em>Read</em> Binding to the selected items of a ListBox (or an another items controls)</a></p> [Performance tips] Use the system shadows instead of your own urn:md5:6ce9a6fcf6a9fa653286c4c02a507fc7 Tue, 27 Apr 2010 23:52:00 +0200 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=""><em>Read</em> [Performance tips] Use the system shadows instead of your own</a></p> Freeze brushes directly in the XAML to improve your application's performances urn:md5:9e20a96580288c5ab39762cf98c5d356 Mon, 12 Apr 2010 22:53:00 +0200 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=""><em>Read</em> Freeze brushes directly in the XAML to improve your application's performances</a></p> Simple properties Mapper by reflection : stop copying manually each property of your objects ! urn:md5:c953a7caee3d6372fc5d0b3b3150e49b Thu, 08 Apr 2010 23:14:00 +0200 .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=""><em>Read</em> Simple properties Mapper by reflection : stop copying manually each property of your objects !</a></p> Binding on a Property which is not a DependencyProperty urn:md5:d2eadacd7db37af377f1b69c8b528bb1 Mon, 05 Apr 2010 09:03:00 +0200 WPF AttachedPropertycustomdataBindingdemoexamplehow tohow-toOnPropertyChangedpatternpatternstipstrickWPF <p>A lot of controls expose properties which are not DependencyProperties and then you can’t put a binding on it. On some other cases, you only have a getter as accessor and you can’t put a binding on it too… This is for example the case for the ribbon’s group of the office ribbon or the converter’s parameter. If you ever tried to do so, you... <a href=""><em>Read</em> Binding on a Property which is not a DependencyProperty</a></p> French WPF community urn:md5:f4ff977c09a5492ad9f5ccab7e2f6436 Wed, 24 Mar 2010 00:05:00 +0100 Other things newsWPF <p>Hello everybody, No funny post since a long time now and there is a reason : I am creating a new web site in French, WPF France. The goal is to create a french WPF community because there is not a lot of resources in French about this great technology. If you want to join the party : mail me ! %%%... <a href=""><em>Read</em> French WPF community</a></p> MVVM - Creating ViewModel : create dynamic proxies with Castle (solution 3 of n) urn:md5:d3a023b93c4a2ef515d002c54361428f Thu, 11 Mar 2010 23:09:00 +0100 WPF CastleDesign patternDynamic proxiesDynamic proxyexampleM-V-VMMVVMpatternpatternsWPF <p>Here is the next episode of our serie MVVM - Creating ViewModel. A list of all the article about creating a ViewModel is here.. Today we are going to see how to create dynamic proxies for our business objects. What are Dynamic proxies ? Readers in a hurry can directly jump to the third part "An implementation". Proxies are a Desing Pattern... <a href=""><em>Read</em> MVVM - Creating ViewModel : create dynamic proxies with Castle (solution 3 of n)</a></p> MVVM - Creating ViewModel tutorial urn:md5:175290551e10776eb81123ddd0100dfa Thu, 11 Mar 2010 11:58:00 +0100 WPF Design patternexamplehow tohow-toM-V-VMMVVMpatternpatternsWPF <p>MVVM - Creating ViewModel is a serie of blogposts that talk in details about various ways to create a ViewModel to use it with the MVVM pattern. You often do not create the business object used by the application which are created by another team and that these objects are not ready for binding. So you must find a solution to create an object... <a href=""><em>Read</em> MVVM - Creating ViewModel tutorial</a></p>