Yet another blog about WPF, Surface, SL, MVVM, NUI.... - Tag - how-to 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 [RIA Services] Why the client extended entities won't use the default backing store value ? EDITED urn:md5:f4e152cbad435cfff073f9d18c88190a 2010-11-19T16:13:00+01:00 2010-11-22T02:34:14+01:00 JonathanANTOINE@falsemail.com Silverlight how tohow-toRIA ServicesSilverlight <p>The title may not be clear but I am talking about the entities that you extends on the client side using the fact that they are partial class. You may think as I was that if you add properties in them with backing store field, the properties will get initialed nicely : this is not the case and the property will always use the default value for the... <a href="http://blog.lexique-du-net.com/index.php?post/2010/11/19/%5BRIA-Services%5D-Why-the-client-extended-entities-won-t-use-the-default-backing-store-value"><em>Read</em> [RIA Services] Why the client extended entities won't use the default backing store value ? EDITED</a></p> http://blog.lexique-du-net.com/index.php?post/2010/11/19/%5BRIA-Services%5D-Why-the-client-extended-entities-won-t-use-the-default-backing-store-value#comment-form http://feeds.feedburner.com/JonathanAntoine/comments/66 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 WPF tip : How can I use static/dynamic resources in my tests urn:md5:4a3dab56d52a0b0385223e6db58a46ec 2010-09-24T12:33:00+02:00 2010-09-24T12:56:03+02:00 JonathanANTOINE@falsemail.com 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="http://blog.lexique-du-net.com/index.php?post/2010/09/24/WPF-tip-How-can-I-use-static/dynamic-resources-in-my-tests"><em>Read</em> WPF tip : How can I use static/dynamic resources in my tests</a></p> http://blog.lexique-du-net.com/index.php?post/2010/09/24/WPF-tip-How-can-I-use-static/dynamic-resources-in-my-tests#comment-form http://feeds.feedburner.com/JonathanAntoine/comments/58 UserControl/Control : how to get a reference to an element of the template urn:md5:31729ab6c8a50b35686f1411e6c53daa 2010-09-14T22:42:00+02:00 2010-09-20T17:40:23+02:00 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://feeds.feedburner.com/JonathanAntoine/comments/54 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 MVVM - Creating ViewModel tutorial urn:md5:175290551e10776eb81123ddd0100dfa 2010-03-11T11:58:00+01:00 2010-03-13T02:27:03+01:00 JonathanANTOINE@falsemail.com 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="http://blog.lexique-du-net.com/index.php?post/2010/03/11/MVVM-Creating-ViewModel-tutorial"><em>Read</em> MVVM - Creating ViewModel tutorial</a></p> http://blog.lexique-du-net.com/index.php?post/2010/03/11/MVVM-Creating-ViewModel-tutorial#comment-form http://feeds.feedburner.com/JonathanAntoine/comments/44 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 MVVM : How to keep collections of ViewModel and Model in sync urn:md5:2b68064f98ad729fd6b43197bb31a7b1 2010-03-02T12:31:00+01:00 2010-03-04T19:52:34+01:00 JonathanANTOINE@falsemail.com WPF Design patternhow tohow-toM-V-VMMVVMpatternpatternsWPF <p>As pointed out in this post collections of the ViewModels and the models are not sync. This is because we do not access directly to the model but to an ObservableCollection(in the viewModel) which contains the object of the original collection(in the model) and that these two collections are not the same... As pointed out in the comments on... <a href="http://blog.lexique-du-net.com/index.php?post/2010/03/02/M-V-VM-How-to-keep-collections-of-ViewModel-and-Model-in-sync"><em>Read</em> MVVM : How to keep collections of ViewModel and Model in sync</a></p> http://blog.lexique-du-net.com/index.php?post/2010/03/02/M-V-VM-How-to-keep-collections-of-ViewModel-and-Model-in-sync#comment-form http://feeds.feedburner.com/JonathanAntoine/comments/39 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 Use AttachedProperties to add behaviors to the components (Ramora pattern) urn:md5:8d01b1ed9b0f1ce60ade839ff9d84a1d 2010-02-19T17:47:00+01:00 2010-03-06T16:15:43+01:00 JonathanANTOINE@falsemail.com WPF AttachedPropertydataBindingDependencyPropertyDesign patternhow tohow-toM-V-VMpatternsWPFXAML <p>The problem In WPF you expect your components/controls to behave exactly as you want to.... but this not always the case. For example : why does this combobox not execute a command when I change the selection or more often why this textbox does not execute a command when I press the Enter (return) key ? This problem often occurs when you use... <a href="http://blog.lexique-du-net.com/index.php?post/2010/02/17/Use-AttachedProperties-to-add-behaviors-to-the-components"><em>Read</em> Use AttachedProperties to add behaviors to the components (Ramora pattern)</a></p> http://blog.lexique-du-net.com/index.php?post/2010/02/17/Use-AttachedProperties-to-add-behaviors-to-the-components#comment-form http://feeds.feedburner.com/JonathanAntoine/comments/31 CREATE, LAUNCH and CONTROL a WPF animation FROM CODE urn:md5:1813871b1ab6d37b27fb1c000f6969c2 2009-07-07T14:30:00+02:00 2010-02-18T20:41:55+01:00 JonathanANTOINE@falsemail.com WPF animationcustomDependencyObjectDependencyPropertyhow-toWPF <p>The problem Sometimes you need to animate your specific object and for this purpose there is the WPF animation. Here are the prerequireds : The property you want to animate must be a DependencyProperty, The property must so be a part of a DependencyObject, Your object must implement IAnimatable to be able to launch the animation. The... <a href="http://blog.lexique-du-net.com/index.php?post/2009/07/07/CREATE%2C-LAUNCH-and-CONTROL-a-WPF-animation-FROM-CODE"><em>Read</em> CREATE, LAUNCH and CONTROL a WPF animation FROM CODE</a></p> http://blog.lexique-du-net.com/index.php?post/2009/07/07/CREATE%2C-LAUNCH-and-CONTROL-a-WPF-animation-FROM-CODE#comment-form http://feeds.feedburner.com/JonathanAntoine/comments/24