Yet another blog about WPF, Surface, SL, MVVM, NUI.... - Tag - how-to - Comments 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 MVVM : How to keep collections of ViewModel and Model in sync - Zar 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#c3476 urn:md5:58d665934014e91f44e18b766dfbb8a7 Mon, 11 Feb 2013 05:19:41 +0100 Zar <p>Nice Post, Thanks.</p> MVVM : How to keep collections of ViewModel and Model in sync - sanjuro 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#c3474 urn:md5:4d5dd04e6f35b8a705e726c267051e90 Mon, 29 Oct 2012 15:50:38 +0100 sanjuro <p>I agree with Nathan, Syncer should be implemented in .NET by default, but i would name it ProxyObservableCollection <img src="themes/default/smilies/smile.png" alt=":)" class="smiley" /></p> Calculate the real difference between two angles, keeping the correct sign - AlexL http://blog.lexique-du-net.com/index.php?post/Calculate-the-real-difference-between-two-angles-keeping-the-sign#c3473 urn:md5:3acb23ecf73534a53ce14f51bab20096 Mon, 22 Oct 2012 00:06:35 +0200 AlexL <p>Thanks, this helped me out big time!</p> Calculate the real difference between two angles, keeping the correct sign - JonathanANTOINE@falsemail.com http://blog.lexique-du-net.com/index.php?post/Calculate-the-real-difference-between-two-angles-keeping-the-sign#c3143 urn:md5:a79c6c1e6fe66c9b485cb1c572e7f01f Fri, 06 Apr 2012 09:02:50 +0200 JonathanANTOINE@falsemail.com <p>Cool !</p> Execute a command on a specified control when clicking on a button - JonathanANTOINE@falsemail.com http://blog.lexique-du-net.com/index.php?post/2010/06/16/Execute-a-command-on-a-specified-control-when-clicking-on-a-button#c3141 urn:md5:737067a8e99048e225e592dc519e84bc Fri, 06 Apr 2012 09:01:17 +0200 JonathanANTOINE@falsemail.com <p>You have to use the code in the&nbsp;<span style="background-color: rgb(238, 238, 238); font-family: monospace; line-height: 15px; text-align: left; ">ReceiveWeakEvent to do this <img src="themes/default/smilies/smile.png" alt=":)" class="smiley" /></span></p> Execute a command on a specified control when clicking on a button - Jeremy McLain http://blog.lexique-du-net.com/index.php?post/2010/06/16/Execute-a-command-on-a-specified-control-when-clicking-on-a-button#c3140 urn:md5:cf06e8b5892980812265fe5761445744 Thu, 05 Apr 2012 23:12:27 +0200 Jeremy McLain <p>How would you do this portion from code behind?</p> <pre> &lt;Button Content="Delete selected" tools:ExecuteCommandOnControl.RoutedCommand="{x:Static igDP:DataPresenterCommands.DeleteSelectedDataRecords}" tools:ExecuteCommandOnControl.Target="{Binding ElementName=dataGrid}" /&gt;</pre> Calculate the real difference between two angles, keeping the correct sign - tigrou http://blog.lexique-du-net.com/index.php?post/Calculate-the-real-difference-between-two-angles-keeping-the-sign#c3137 urn:md5:448db09b9bfe1cf48764bf68f7a0dffe Thu, 12 Jan 2012 13:18:30 +0100 tigrou <p>Perfect ! just what i was looking for. Tested and works successfully !</p> MVVM - How to integrate the Office Ribbon respecting the pattern (especially the commands) - online writing http://blog.lexique-du-net.com/index.php?post/2010/02/28/MVVM-How-to-integrate-the-Office-Ribbon#c3133 urn:md5:3d81c5145cf4ce910b906d5b44273b08 Fri, 16 Dec 2011 16:52:49 +0100 online writing <p>I am very interested in this sphere and reading this post I have known many new things, which I have not known before. Thanks for publishing this great article here.</p> MVVM : How to keep collections of ViewModel and Model in sync - David 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#c3127 urn:md5:04fb361ee7f4e82ae23c1ad4b5fc8348 Sat, 17 Sep 2011 18:37:08 +0200 David <p>Great post. Thanks!</p> [UPDATED] How to call the method from the base of the base of the current class ? (base.base.MyMethod) - Jonathan ANTOINE 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#c3030 urn:md5:453c0832f348b8ff12dc912038e3a432 Fri, 13 May 2011 10:25:44 +0200 Jonathan ANTOINE <p>@<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#c3025" rel="nofollow">Thomas Levesque</a>&nbsp;:Hello Thomas,</p> <p>Thank you for your comment and it works like a charm <img src="themes/default/smilies/wink.png" alt=";-)" class="smiley" /> !</p> <p>Btw, there is still reflection in your solution, the only difference is that we use 'this' as the current instance without recreating one.</p> <p>I will update my post to add your solution <img src="themes/default/smilies/smile.png" alt=":-)" class="smiley" /></p> <p>Thx a lot !</p> [UPDATED] How to call the method from the base of the base of the current class ? (base.base.MyMethod) - Thomas Levesque 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#c3025 urn:md5:305c99d1c08a3d64b04642e5989c0527 Fri, 13 May 2011 00:31:53 +0200 Thomas Levesque <p>Interesting...<br /> .<br /> Normally, you should never need to call base.base.SomeMethod, it's usually a sign of a bad design because you're not supposed to be aware of implementation details of the base class. But of course in the case of the TabControl you're not in control of the base classes, so it's different...<br /> .<br /> Anyway, I don't really like this solution... Two main reasons :<br /> - you have to create a dummy instance of the class, which is pretty bad for performance and could have unexpected side effects<br /> - it uses reflection (also bad for performance) on a non documented private field of the Delegate class. The implementation of this class could change in future versions, and this solution wouldn't work any more.<br /> .<br /> What you need to achieve this is a non-virtual call to GrandFather.MyMethod. This can be done by generating code at runtime with DynamicMethod:</p> <pre> class Child : Father { private delegate void MyMethodOpenDelegate(GrandFather instance, object param); private static readonly MyMethodOpenDelegate _grandFather_MyMethod; static Child() { DynamicMethod dm = new DynamicMethod( "grandFather_MyMethod", typeof(void), new Type[] {typeof(GrandFather), typeof(object)}, typeof(Child)); var il = dm.GetILGenerator(); il.Emit(OpCodes.Ldarg_0); il.Emit(OpCodes.Ldarg_1); il.EmitCall(OpCodes.Call, typeof(GrandFather).GetMethod("MyMethod"), null); il.Emit(OpCodes.Ret); _grandFather_MyMethod = (MyMethodOpenDelegate)dm.CreateDelegate( typeof(MyMethodOpenDelegate)); } public override void MyMethod(object param) { _grandFather_MyMethod(this, param); } }</pre> <p>(note the use of OpCodes.Call instead of OpCodes.Callvirt)</p> [ping] [UPDATED] How to call the method from the base of the base of the current class ? (base.base.MyMethod) - DotNetKicks.com 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#c3018 urn:md5:761147145e4258d01f6fd2d6605c32e1 Thu, 12 May 2011 00:00:34 +0200 DotNetKicks.com <p><a href="http://www.dotnetkicks.com/csharp/How_to_call_the_method_from_the_base_of_the_base_of_the_current_class">How to call the method from the base of the base of the</a></p> <!-- TB --> <p>You've been kicked (a good thing) - Trackback from DotNetKicks.com...</p> [ping] [UPDATED] How to call the method from the base of the base of the current class ? (base.base.MyMethod) - DotNetShoutout 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#c3017 urn:md5:2f9a841379c0f7838a8e765a2175e57e Thu, 12 May 2011 00:00:22 +0200 DotNetShoutout <p><a href="http://dotnetshoutout.com/How-to-call-the-method-from-the-base-of-the-base-of-the-current-class-basebaseMyMethod">How to call the method from the base of the base of the</a></p> <!-- TB --> <p>Thank you for submitting this cool story - Trackback from DotNetShoutout...</p> Calculate the real difference between two angles, keeping the correct sign - RNH http://blog.lexique-du-net.com/index.php?post/Calculate-the-real-difference-between-two-angles-keeping-the-sign#c3004 urn:md5:488f8700ec7634b244e273bddcb68720 Wed, 04 May 2011 04:31:45 +0200 RNH <p>If you only want to know the absolute difference then you can use<br /> DEL = PI - ABS(PI - ABS(A - B)) in radians.<br /> DEL = 180 - ABS(180- ABS(A - B)) in degrees.</p> Calculate the real difference between two angles, keeping the correct sign - marco polo http://blog.lexique-du-net.com/index.php?post/Calculate-the-real-difference-between-two-angles-keeping-the-sign#c2986 urn:md5:761d4a9cbd304434f048d39277d3ecc5 Thu, 28 Apr 2011 22:09:55 +0200 marco polo <p>try this..</p> <pre> private static double GetPositiveAngle(double radian) { if (radian &lt; 0) radian = (Math.PI * 2) - Math.Abs(radian); return radian; }</pre> <pre> public static double GetAngleDifference(double angle1, double angle2) { var rslt1 = GetPositiveAngle(angle1); var rslt2 = GetPositiveAngle(angle2); if (rslt2 &lt; rslt1) rslt2 += 2 * Math.PI; return rslt2 - rslt1; }</pre> Calculate the real difference between two angles, keeping the correct sign - AronT http://blog.lexique-du-net.com/index.php?post/Calculate-the-real-difference-between-two-angles-keeping-the-sign#c2979 urn:md5:819c641b2fd9fc2efdb134e1a7ed178e Sun, 24 Apr 2011 16:42:33 +0200 AronT <p>A snippet of code taken from my archive in Blitz3D that was used to turn a missile towards the player</p> <p>It eliminates the need to use mod<br /> Will work with angles of any size<br /> Returns an angle in the range -180 to 180<br /> (<br /> diffangle = (actualangle - destangle) + 180;<br /> diffangle = (diffangle / 360.0)<br /> diffangle = ((diffangle - Floor( diffangle )) * 360.0) - 180;<br /> )<br /> !Notes: The Floor command takes the float number and rounds it down to the nearest whole number!</p> Calculate the real difference between two angles, keeping the correct sign - Alan http://blog.lexique-du-net.com/index.php?post/Calculate-the-real-difference-between-two-angles-keeping-the-sign#c2891 urn:md5:09a46b577ff2609834813e3dde8a8605 Fri, 08 Apr 2011 12:09:28 +0200 Alan <p>I use:</p> <p>differenceAngle = (targetAngle - currentAngle) % 360.</p> <p>this gives you the angle of the target relative to current angle, and is positive for a clockwise rotation.</p> [Performance tips] Use the system shadows instead of your own - Jonathan ANTOINE http://blog.lexique-du-net.com/index.php?post/2010/04/27/Performance-tips-Use-the-system-shadows-instead-of-your-own#c2660 urn:md5:29b985fcf9dc7f164a6033261ae123ab Mon, 28 Mar 2011 21:09:11 +0200 Jonathan ANTOINE <p>@<a href="http://blog.lexique-du-net.com/index.php?post/2010/04/27/Performance-tips-Use-the-system-shadows-instead-of-your-own#c2646" rel="nofollow">Nirvi</a>&nbsp;: I think it will still work because we use a specific control (the shadow) in a specific assembly and not the theme system as a whole.</p> [Performance tips] Use the system shadows instead of your own - Nirvi http://blog.lexique-du-net.com/index.php?post/2010/04/27/Performance-tips-Use-the-system-shadows-instead-of-your-own#c2646 urn:md5:a959b69f409d69562826c6c23794f17c Sun, 27 Mar 2011 13:41:24 +0200 Nirvi <p>What if the user runs on XP SP3 with some of the freaky themes, will the Shadow Chrome appear?</p> [RIA Services] Why the client extended entities won't use the default backing store value ? EDITED - Jonathan ANTOINE 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#c2514 urn:md5:af4dceff71c2ccd5cde4ff190fb0ff37 Mon, 22 Nov 2010 01:33:22 +0100 Jonathan ANTOINE <p>@<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#c2512" rel="nofollow">Jeff Handley</a>&nbsp;: thx for the info !</p>