Yet another blog about WPF, Surface, SL, MVVM, NUI.... - Tag - trick 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 ! 2024-02-26T15:40:43+01:00 Jonathan ANTOINE urn:md5:627146f22bec1346990949372a159bfa Dotclear [UPDATED] How to call the method from the base of the base of the current class ? (base.base.MyMethod) urn:md5:d900bf7d396d3bc1a150d6e19676cfd9 2011-05-11T23:56:00+02:00 2011-08-10T14:46:30+02:00 JonathanANTOINE@falsemail.com .NET controlscustomDependencyPropertyhow tohow-totipstrick <p>Today I encountered a tricky need in some custom control. It was inheriting from the TabControl but I didn’t want all its feature. Especially I didn’t want it to update the SelectedContent dependency property because it was keeping a strong reference to a ViewModel and keeping it away from the garbage collector.</p> <p>  The problem is that the TabControl do this in an event handler of the ItemContainerGenerator’s StatusChanged event. This subscription is made in the OnInitialized method. This one is marked as protected and virtual so I could override it to do nothing but if had do so I would have loose all the work done in the base class of the TabControl which... <a href="http://blog.lexique-du-net.com/index.php?post/2011/05/11/How-to-call-the-method-from-the-base-of-the-base-of-the-current-class-%28base.base.MyMethod%29"><em>Read</em> [UPDATED] How to call the method from the base of the base of the current class ? (base.base.MyMethod)</a></p> http://blog.lexique-du-net.com/index.php?post/2011/05/11/How-to-call-the-method-from-the-base-of-the-base-of-the-current-class-%28base.base.MyMethod%29#comment-form http://feeds.feedburner.com/JonathanAntoine/comments/75 What ? Dynamic resources creates Memory leaks in WPF 3.5 (SP1) ??? urn:md5:20f78de56ffc9f29719df87fb78511c5 2011-03-27T08:12:00+02:00 2011-03-27T18:17:10+02:00 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://feeds.feedburner.com/JonathanAntoine/comments/74 VS Tip : how to locate the active document in the solution explorer using a shortcut urn:md5:8528a0336d20cda80f60db7cdd7f5ce3 2010-11-04T12:39:00+01:00 2010-11-04T13:44:05+01:00 JonathanANTOINE@falsemail.com .NET examplehow tohow-totipstrickVisual Studio <p>When you have multiple projects in your solution, you often want to locate the active document in the solution explorer. There is a great option in Visual Studio which can do it for you all the time : “View.TrackActivityInSolutionExplorer”.   But if you do not want (as me) to turn it on all the time, there is no specific option or shortcut. So I... <a href="http://blog.lexique-du-net.com/index.php?post/2010/11/04/VS-Tip-%3A-how-to-locate-the-active-document-in-the-solution-explorer-using-a-shortcut"><em>Read</em> VS Tip : how to locate the active document in the solution explorer using a shortcut</a></p> http://blog.lexique-du-net.com/index.php?post/2010/11/04/VS-Tip-%3A-how-to-locate-the-active-document-in-the-solution-explorer-using-a-shortcut#comment-form http://feeds.feedburner.com/JonathanAntoine/comments/65 How to create an hand writing to text control (ink recognizer) urn:md5:f9aea256e97acb32c48044cd92d26be4 2010-10-25T00:01:00+02:00 2011-03-24T21:57:03+01:00 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://feeds.feedburner.com/JonathanAntoine/comments/55 How to create your own control library (how-to + tips) urn:md5:9ed22011e4c8dd030431d70034af0342 2010-10-03T23:27:00+02:00 2010-10-04T17:42:57+02:00 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://feeds.feedburner.com/JonathanAntoine/comments/59 How to create an animated expander urn:md5:2ae908d20a12760560980c024eaabac7 2010-09-21T14:02:00+02:00 2010-09-21T15:03:55+02:00 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://feeds.feedburner.com/JonathanAntoine/comments/56 Execute a command on a specified control when clicking on a button urn:md5:d120a96b6da17f34e9dcdd2044d853d9 2010-06-16T15:07:00+02:00 2010-06-16T15:39:39+02:00 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://feeds.feedburner.com/JonathanAntoine/comments/52 Binding to the selected items of a ListBox (or an another items controls) urn:md5:04ab1651e48f6d69d4b3c1afa893f976 2010-06-13T12:03:00+02:00 2010-06-14T15:53:51+02:00 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://feeds.feedburner.com/JonathanAntoine/comments/51 [Performance tips] Use the system shadows instead of your own urn:md5:6ce9a6fcf6a9fa653286c4c02a507fc7 2010-04-27T23:52:00+02:00 2010-04-28T00:24:05+02:00 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://feeds.feedburner.com/JonathanAntoine/comments/50 Freeze brushes directly in the XAML to improve your application's performances urn:md5:9e20a96580288c5ab39762cf98c5d356 2010-04-12T22:53:00+02:00 2010-04-14T18:10:46+02:00 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://feeds.feedburner.com/JonathanAntoine/comments/49 Simple properties Mapper by reflection : stop copying manually each property of your objects ! urn:md5:c953a7caee3d6372fc5d0b3b3150e49b 2010-04-08T23:14:00+02:00 2010-04-09T01:32:10+02:00 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://feeds.feedburner.com/JonathanAntoine/comments/48 Binding on a Property which is not a DependencyProperty urn:md5:d2eadacd7db37af377f1b69c8b528bb1 2010-04-05T09:03:00+02:00 2010-04-07T20:51:22+02:00 JonathanANTOINE@falsemail.com 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="http://blog.lexique-du-net.com/index.php?post/2010/03/31/Binding-on-a-Property-which-is-not-a-DependencyProperty"><em>Read</em> Binding on a Property which is not a DependencyProperty</a></p> http://blog.lexique-du-net.com/index.php?post/2010/03/31/Binding-on-a-Property-which-is-not-a-DependencyProperty#comment-form http://feeds.feedburner.com/JonathanAntoine/comments/47 Sync framework - choose your primary keys type carefully urn:md5:f03061bd8b71e7fe141447d38e94fd42 2010-03-05T00:44:00+01:00 2010-03-05T02:49:01+01:00 JonathanANTOINE@falsemail.com .NET how tohow-toSync Frameworktipstrick <p>Do you know the Sync Framework ? This is an amazing framework that enables roaming, sharing of data, and taking data offline ! One usage You can imagine is to sync some local clients databases with a big distant one. Each client taking its data with him and each client was abble to edit/create/delete data. The scenarii where the problem... <a href="http://blog.lexique-du-net.com/index.php?post/2010/03/05/Sync-framework-choose-your-primary-keys-type-carefully"><em>Read</em> Sync framework - choose your primary keys type carefully</a></p> http://blog.lexique-du-net.com/index.php?post/2010/03/05/Sync-framework-choose-your-primary-keys-type-carefully#comment-form http://feeds.feedburner.com/JonathanAntoine/comments/41 MVVM - How to integrate the Office Ribbon respecting the pattern (especially the commands) urn:md5:b21944e275d0dc07e8f8d58a593fcab3 2010-03-04T20:01:00+01:00 2010-03-04T20:29:25+01:00 JonathanANTOINE@falsemail.com WPF DependencyObjectDependencyPropertyDesign patternhow tohow-toM-V-VMMVVMpatternpatternstipstrickWPF <p>Synopsis The ribbon controls - introduced by office 2007 -are available for free on the Microsoft Office web site (French users should set the language to "english" to access the ressources). They can leverage the user's experience of your application and are pretty simple to use. When I wanted to add them into one of my application I realized... <a href="http://blog.lexique-du-net.com/index.php?post/2010/02/28/MVVM-How-to-integrate-the-Office-Ribbon"><em>Read</em> MVVM - How to integrate the Office Ribbon respecting the pattern (especially the commands)</a></p> http://blog.lexique-du-net.com/index.php?post/2010/02/28/MVVM-How-to-integrate-the-Office-Ribbon#comment-form http://feeds.feedburner.com/JonathanAntoine/comments/38 DependencyProperties or INotifyPropertyChanged ? urn:md5:441834c0aab7c5bc41e56298bff51219 2010-03-01T12:31:00+01:00 2010-03-10T17:05:14+01:00 JonathanANTOINE@falsemail.com WPF AttachedPropertydataBindingDependencyObjectDependencyPropertyeventsexamplehow toOnPropertyChangedtipstrickWPFXAML <p>When you want to make an object binding-aware you have two choices : implement INotifyPropertyChanged or create DependencyProperties. Which one is the best ? Let's try to answer this question ! How to implement INotifyPropertyChanged Declaring that your class is implementing INotifyPropertyChanged adds an PropertyChangedEventHandler that you... <a href="http://blog.lexique-du-net.com/index.php?post/2010/02/24/DependencyProperties-or-INotifyPropertyChanged"><em>Read</em> DependencyProperties or INotifyPropertyChanged ?</a></p> http://blog.lexique-du-net.com/index.php?post/2010/02/24/DependencyProperties-or-INotifyPropertyChanged#comment-form http://feeds.feedburner.com/JonathanAntoine/comments/34 WPF - catch events even if they are already handled urn:md5:da20672ee31976501c4a2234e995ed7c 2010-02-19T19:04:00+01:00 2010-02-22T11:36:03+01:00 JonathanANTOINE@falsemail.com WPF eventshow tohow-totipstrickWPF <p>As you may actually know WPF introduced the routed events. These last are no more specific to a single control but they are routed inside the tree of your controls. If you want to stop an event, you can mark it as Handled. If so, the routing engine will stop to propage it. In fact this is just an illusion because the engine will only stop... <a href="http://blog.lexique-du-net.com/index.php?post/2010/02/18/WPF-catch-events-even-if-already-handled"><em>Read</em> WPF - catch events even if they are already handled</a></p> http://blog.lexique-du-net.com/index.php?post/2010/02/18/WPF-catch-events-even-if-already-handled#comment-form http://feeds.feedburner.com/JonathanAntoine/comments/32