Yet another blog about WPF, Surface, SL, MVVM, NUI.... - WPFIn 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:00Jonathan ANTOINEurn:md5:627146f22bec1346990949372a159bfaDotclearAmazing WPF Controls / JetPack Theme updated !urn:md5:88ead68957a351bbe11ed3474c8ea2f32011-06-13T13:56:00+02:002011-06-13T14:10:39+02:00JonathanANTOINE@falsemail.comWPFanimationcontrolsnewsTemplateWPFXAML <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="http://blog.lexique-du-net.com/index.php?post/2011/06/13/Amazing-WPF-Controls-/-JetPack-Theme-updated-%21"><em>Read</em> Amazing WPF Controls / JetPack Theme updated !</a></p>http://blog.lexique-du-net.com/index.php?post/2011/06/13/Amazing-WPF-Controls-/-JetPack-Theme-updated-%21#comment-formhttp://feeds.feedburner.com/JonathanAntoine/comments/76What ? Dynamic resources creates Memory leaks in WPF 3.5 (SP1) ???urn:md5:20f78de56ffc9f29719df87fb78511c52011-03-27T08:12:00+02:002011-03-27T18:17:10+02:00JonathanANTOINE@falsemail.comWPFDynamicleakmemoryperformanceResourcestipstrickWindows 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> 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. </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-formhttp://feeds.feedburner.com/JonathanAntoine/comments/74UIAutomation, Coded UI tests, AutomationPeer and WPF/silverlight custom controlsurn:md5:629820d459b6479cd3dee0084d2f31792011-03-24T00:04:00+01:002011-03-26T01:09:55+01:00JonathanANTOINE@falsemail.comWPFAutomationCoded 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. </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-formhttp://feeds.feedburner.com/JonathanAntoine/comments/72Introducing the amazing WPF controls library on Codeplex !urn:md5:38e0ac0a863f442767c1a2a1d9bf34312010-10-25T01:19:00+02:002011-01-12T00:08:30+01:00JonathanANTOINE@falsemail.comWPFcontrolsdemoexampleWindows 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-formhttp://feeds.feedburner.com/JonathanAntoine/comments/63Migrate the Jetpack theme from Silverlight to WPFurn:md5:b8f2e7c8b33b26254f7cc2e5daca903a2010-10-14T12:54:00+02:002010-10-16T01:39:58+02:00JonathanANTOINE@falsemail.comWPFMigrationSilverlightThemeWindows 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-formhttp://feeds.feedburner.com/JonathanAntoine/comments/61How to create your own control library (how-to + tips)urn:md5:9ed22011e4c8dd030431d70034af03422010-10-03T23:27:00+02:002010-10-04T17:42:57+02:00JonathanANTOINE@falsemail.comWPFBindingContentControlcontrolscustomdataBindingDataTemplateDependencyPropertyeventsexamplehow 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-formhttp://feeds.feedburner.com/JonathanAntoine/comments/59WPF tip : How can I use static/dynamic resources in my testsurn:md5:4a3dab56d52a0b0385223e6db58a46ec2010-09-24T12:33:00+02:002010-09-24T12:56:03+02:00JonathanANTOINE@falsemail.comWPF.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-formhttp://feeds.feedburner.com/JonathanAntoine/comments/58Quick tip : My WPF Fullscreen window still display a border on right and bottom side... how to remove themurn:md5:066836186ab1c7f17c53c7c5c0ada8c92010-09-23T11:35:00+02:002010-09-23T12:13:23+02:00JonathanANTOINE@falsemail.comWPF <p>Creating a fullscreen window in WPF is quite simple, you just have to set WindowState to Maximized and WindowStyle to None.
But in my current project I was facing a little drawback : a border was still visible on the bottom and on the right side of my window :
I have seen some solution on the web talking about Win32 interop and... <a href="http://blog.lexique-du-net.com/index.php?post/2010/09/23/Quick-tip-%3A-My-WPF-Fullscreen-window-still-display-a-border-on-right-and-bottom-side...-how-to-remove-it"><em>Read</em> Quick tip : My WPF Fullscreen window still display a border on right and bottom side... how to remove them</a></p>http://blog.lexique-du-net.com/index.php?post/2010/09/23/Quick-tip-%3A-My-WPF-Fullscreen-window-still-display-a-border-on-right-and-bottom-side...-how-to-remove-it#comment-formhttp://feeds.feedburner.com/JonathanAntoine/comments/57How to create an animated expanderurn:md5:2ae908d20a12760560980c024eaabac72010-09-21T14:02:00+02:002010-09-21T15:03:55+02:00JonathanANTOINE@falsemail.comWPFanimationContentControlexamplesamplescalescalingTemplatetipstrickWindows 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-formhttp://feeds.feedburner.com/JonathanAntoine/comments/56UserControl/Control : how to get a reference to an element of the templateurn:md5:31729ab6c8a50b35686f1411e6c53daa2010-09-14T22:42:00+02:002010-09-20T17:40:23+02:00JonathanANTOINE@falsemail.comWPFContentControlcontrolscustomDataTemplateexceptionhow 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-formhttp://feeds.feedburner.com/JonathanAntoine/comments/54Execute a command on a specified control when clicking on a buttonurn:md5:d120a96b6da17f34e9dcdd2044d853d92010-06-16T15:07:00+02:002010-06-16T15:39:39+02:00JonathanANTOINE@falsemail.comWPFAttachedPropertyBindingdataBindingDependencyObjectDependencyPropertyeventsexamplehow 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-formhttp://feeds.feedburner.com/JonathanAntoine/comments/52Binding to the selected items of a ListBox (or an another items controls)urn:md5:04ab1651e48f6d69d4b3c1afa893f9762010-06-13T12:03:00+02:002010-06-14T15:53:51+02:00JonathanANTOINE@falsemail.comWPFAttachedPropertyBindingdataBindingDependencyObjectDependencyPropertyDesign 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-formhttp://feeds.feedburner.com/JonathanAntoine/comments/51[Performance tips] Use the system shadows instead of your ownurn:md5:6ce9a6fcf6a9fa653286c4c02a507fc72010-04-27T23:52:00+02:002010-04-28T00:24:05+02:00JonathanANTOINE@falsemail.comWPFaerodemoexamplehow 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-formhttp://feeds.feedburner.com/JonathanAntoine/comments/50Freeze brushes directly in the XAML to improve your application's performancesurn:md5:9e20a96580288c5ab39762cf98c5d3562010-04-12T22:53:00+02:002010-04-14T18:10:46+02:00JonathanANTOINE@falsemail.comWPFexamplefreezehow 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-formhttp://feeds.feedburner.com/JonathanAntoine/comments/49Binding on a Property which is not a DependencyPropertyurn:md5:d2eadacd7db37af377f1b69c8b528bb12010-04-05T09:03:00+02:002010-04-07T20:51:22+02:00JonathanANTOINE@falsemail.comWPFAttachedPropertycustomdataBindingdemoexamplehow 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-formhttp://feeds.feedburner.com/JonathanAntoine/comments/47MVVM - Creating ViewModel : create dynamic proxies with Castle (solution 3 of n)urn:md5:f22a115f339bda3d1a6097fa1221a3332010-03-11T23:37:00+01:002010-03-12T00:40:57+01:00JonathanANTOINE@falsemail.comWPF <p>In fact you are looking for this page : MVVM - Creating ViewModel : create dynamic proxies with Castle (solution 3 of n)... <a href="http://blog.lexique-du-net.com/index.php?post/2010/03/11/MVVM-Creating-ViewModel-%3A-create-dynamic-proxies-with-Castle-%28solution-3-of-n%29."><em>Read</em> MVVM - Creating ViewModel : create dynamic proxies with Castle (solution 3 of n)</a></p>http://blog.lexique-du-net.com/index.php?post/2010/03/11/MVVM-Creating-ViewModel-%3A-create-dynamic-proxies-with-Castle-%28solution-3-of-n%29.#comment-formhttp://feeds.feedburner.com/JonathanAntoine/comments/45MVVM - Creating ViewModel : create dynamic proxies with Castle (solution 3 of n)urn:md5:d3a023b93c4a2ef515d002c54361428f2010-03-11T23:09:00+01:002010-03-12T12:59:13+01:00JonathanANTOINE@falsemail.comWPFCastleDesign 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="http://blog.lexique-du-net.com/index.php?post/2010/03/11/MVVM-Creating-ViewModel-%3A-create-dynamic-proxies-with-Castle"><em>Read</em> MVVM - Creating ViewModel : create dynamic proxies with Castle (solution 3 of n)</a></p>http://blog.lexique-du-net.com/index.php?post/2010/03/11/MVVM-Creating-ViewModel-%3A-create-dynamic-proxies-with-Castle#comment-formhttp://feeds.feedburner.com/JonathanAntoine/comments/43MVVM - Creating ViewModel tutorialurn:md5:175290551e10776eb81123ddd0100dfa2010-03-11T11:58:00+01:002010-03-13T02:27:03+01:00JonathanANTOINE@falsemail.comWPFDesign 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-formhttp://feeds.feedburner.com/JonathanAntoine/comments/44MVVM - How to integrate the Office Ribbon respecting the pattern (especially the commands)urn:md5:b21944e275d0dc07e8f8d58a593fcab32010-03-04T20:01:00+01:002010-03-04T20:29:25+01:00JonathanANTOINE@falsemail.comWPFDependencyObjectDependencyPropertyDesign 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-formhttp://feeds.feedburner.com/JonathanAntoine/comments/38MVVM : How to keep collections of ViewModel and Model in syncurn:md5:2b68064f98ad729fd6b43197bb31a7b12010-03-02T12:31:00+01:002010-03-04T19:52:34+01:00JonathanANTOINE@falsemail.comWPFDesign 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-formhttp://feeds.feedburner.com/JonathanAntoine/comments/39