<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Jaime Rodriguez  : Windows Presentation Foundation</title><link>http://blogs.msdn.com/jaimer/archive/tags/Windows+Presentation+Foundation/default.aspx</link><description>Tags: Windows Presentation Foundation</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Introduction to WPF 4 Multitouch</title><link>http://blogs.msdn.com/jaimer/archive/2009/11/04/introduction-to-wpf-4-multitouch.aspx</link><pubDate>Wed, 04 Nov 2009 08:02:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9915764</guid><dc:creator>jaimer</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/jaimer/comments/9915764.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jaimer/commentrss.aspx?PostID=9915764</wfw:commentRss><description>&lt;p&gt;This tutorial recaps the multitouch features in WPF 4, as of the Beta 2 release.    &lt;br /&gt;I also included two basic samples to get you jumpstarted with working code: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="#rawtouchdemo"&gt;SketchPad using raw touch in WPF4&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="#manipulationdemo"&gt;Image Manipulation in WPF 4&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;A Multitouch Backgrounder&lt;/strong&gt;&lt;/p&gt; &lt;strong&gt;&lt;/strong&gt;  &lt;p&gt;Multitouch is simply an abstraction from the OS (or a platform) that routes touch input to an application.&amp;#160; &lt;br /&gt;The OS exposes multitouch input with different levels of control and/or detail.&amp;#160; For example, Windows 7 exposes multitouch data in three modes: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;Raw touch&lt;/strong&gt; provides access to all touch messages. Aggregation or interpretation of the messages is left to the application. This level of access is useful for programs that require raw access to all the primitives possibly for some custom interpretation and handling of the messages. For example Corel Paint It Touch and Windows 7 Paint require this level of control to implement drawing. Other possible consumers for this level of detail are custom control or platform vendors.       &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Gestures &lt;/strong&gt;is a very convenient abstraction from raw-touch.       &lt;br /&gt;The platform interprets all the lower level events and translates them into pre-defined gestures, then notifies the application that a gesture has occurred.&amp;#160; The most common gestures are pan, zoom, rotate, and tap.       &lt;br /&gt;Gestures offers a very easy programming model, but it has a limitation: gestures engines tend to handle only one gesture at a time ( for example, rotate or zoom, but not a rotate with zoom).&amp;#160;&amp;#160; &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Manipulation and inertia&lt;/strong&gt;.&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;Manipulation is a superset of gestures; any thing you can do with gestures, you can do with manipulations, but you gain greater granularity and flexibility.&amp;#160; Of course, the trade-off is that manipulation is a pinch harder to program than gestures, but don’t worry, both are straight forward.       &lt;br /&gt;Inertia is an extension to manipulation that adds physics support to make all of your manipulations smooth and realistic. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;If you are not familiar with multitouch, I recommend these articles on multitouch in Windows 7: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/dd371413(VS.85).aspx" target="_blank"&gt;Windows 7 Multitouch Architecture&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/dd562100(VS.85).aspx" target="_blank"&gt;Choosing the Right Approach To Windows Touch&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/dd940543(VS.85).aspx" target="_blank"&gt;Windows Touch Gestures Overview&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/dd317309(VS.85).aspx" target="_blank"&gt;Manipulation and Inertia Overview&lt;/a&gt;       &lt;br /&gt;&lt;/li&gt; &lt;/ul&gt; Now that you are a touch expert,&amp;#160; we can simply focus on explaining WPF’s support.   &lt;br /&gt;  &lt;p&gt;&lt;strong&gt;&lt;u&gt;&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Multitouch in WPF 4&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;WPF 4 includes support for raw touch and manipulation (with some inertia support).&amp;#160; This support extends throughout the platform; UIElement, UIElement3D, and ContentElement have all been tweaked to support raw-touch and manipulation. &lt;/p&gt;  &lt;p&gt;Post beta2, WPF 4 will also support touch in some of the controls (for example, ScrollViewer). The list of controls and level of support is not yet finalized, so don’t hold it against me; I will update this post as soon as I get details. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;u&gt;Approach #1: Raw-touch in WPF 4 &lt;/u&gt;&lt;/strong&gt;    &lt;br /&gt;    &lt;br /&gt;Again, raw multitouch support begins at UIElement, UIElement3D and ContentElement.     &lt;br /&gt;All of these types now support a TouchDown, TouchUp, TouchMove, TouchEnter and TouchLeave event.     &lt;br /&gt;Each of these events have a corresponding routed event and a tunneling (Preview) event.&amp;#160; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;public static readonly RoutedEvent TouchDownEvent; &lt;/li&gt;    &lt;li&gt;public static readonly RoutedEvent TouchEnterEvent; &lt;/li&gt;    &lt;li&gt;public static readonly RoutedEvent TouchLeaveEvent; &lt;/li&gt;    &lt;li&gt;public static readonly RoutedEvent TouchMoveEvent; &lt;/li&gt;    &lt;li&gt;public static readonly RoutedEvent TouchUpEvent; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;If you drill down through these events, you will find they all have a TouchEventArgs parameter that holds a TouchDevice member and can get you a TouchPoint.&amp;#160; The TouchPoint is the meaningful data since it tells you whether it was a Up,Down, or Move TouchAction, and it tells you the Position where the touch happened.    &lt;br /&gt;    &lt;br /&gt;I have included a class diagram below; the names are pretty descriptive. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/jaimer/WindowsLiveWriter/IntroductiontoMultiTouchInWPF4_1399F/Touch_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Touch" border="0" alt="Touch" src="http://blogs.msdn.com/blogfiles/jaimer/WindowsLiveWriter/IntroductiontoMultiTouchInWPF4_1399F/Touch_thumb.png" width="784" height="387" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Handling raw touch in WPF is really as simple as listening for these events and reacting to the points and the actions.&amp;#160; &lt;br /&gt;Unlike Manipulation where you do have to opt-in by setting the IsManipulationEnabled property to true,&amp;#160; event notifications for raw touch are available without an explicit opt-in &lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;&lt;a name="rawtouchdemo"&gt;A sample application for raw touch&lt;/a&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Of course, for raw touch I had to create the canonical &lt;a href="http://blogs.msdn.com/blogfiles/jaimer/WindowsLiveWriter/IntroductiontoWPF4Multitouch_12FBA/helloMT_4.png"&gt;&lt;img style="border-right-width: 0px; margin: 0px 50px 0px 35px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="helloMT" border="0" alt="helloMT" align="right" src="http://blogs.msdn.com/blogfiles/jaimer/WindowsLiveWriter/IntroductiontoWPF4Multitouch_12FBA/helloMT_thumb_4.png" width="358" height="196" /&gt;&lt;/a&gt; drawing pad.&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;      &lt;br /&gt;Disclaimer: I took the code written by Sela to demonstrate the .NET wrappers for Windows 7 multitouch and simply ported it to WPF 4.&amp;#160; Taking their apps and porting them to WPF 4 was about a 15 minute exercise. &lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;Download the &lt;a href="http://www.cookingwithxaml.com/recipes/wpf4/wpf4touch.zip"&gt;source code&lt;/a&gt;.&amp;#160;&amp;#160; &lt;/p&gt;    &lt;p&gt;When running the app, simply apply multiple fingers through the window to have the drawing pad draw strokes that follow your fingers’ movements. &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;   &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Approach #2: Manipulation in WPF 4&lt;u&gt;        &lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;    &lt;br /&gt;Manipulation in WPF 4 is an opt-in behavior.&amp;#160; There is a simple process to handle manipulation events in any WPF element: &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Set IsManipulationEnabled=true on the element you are touch enabling. You can do this from XAML or from code.&amp;#160; &lt;br /&gt;&lt;span style="background-color: #efefef"&gt;&lt;span style="color: blue"&gt;         &lt;br /&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;image&amp;quot;&lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;200&amp;quot;&lt;/span&gt;&lt;span style="color: red"&gt;IsManipulationEnabled&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;True&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Windows7.png&amp;quot;&amp;gt;          &lt;br /&gt;&lt;/span&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;    &lt;li&gt;[Optional] Subscribe to ManipulationStarting and set your ContainerElement.&amp;#160; &lt;br /&gt;The ContainerElement is the UI element to which all manipulation calculations and events are relative. If you do not set a ContainerElement, the UI element that is firing the event will be used. This works well for Zoom/Scale, but for all Translate or Rotate manipulations you should set a ContainerElement, or else the UI will flicker and be jumpy. This is not a UI glitch, it happens because a single manipulation will fire multiple deltas, so you are recording movements relative to the UI element that is being moved. Not cool!       &lt;br /&gt;      &lt;br /&gt;In ManipulationStarting, you can also set your ManipulationMode to control the manipulations you are allowing. You can select from All | None | Rotate | Translate | Scale | TranslateX | TranslateY. If you don’t override it, the default is All.       &lt;br /&gt;      &lt;br /&gt;Finally, if you want to do single hand rotations, you can set a Pivot that your UI element will rotate around.       &lt;br /&gt;      &lt;pre style="background-color: #efefef" class="code"&gt;&lt;span style="color: blue"&gt; void &lt;/span&gt;image_ManipulationStarting(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;ManipulationStartingEventArgs &lt;/span&gt;e)
 {   
        &lt;span style="color: green"&gt;//canvas is the parent of the image starting the manipulation;
        //Container does not have to be parent, but that is the most common scenario
         &lt;/span&gt;e.ManipulationContainer = canvas; 
        &lt;span style="color: green"&gt;// you could set the mode here too 
        // e.Mode = ManipulationModes.All;             
&lt;/span&gt; }&lt;br /&gt;&lt;/pre&gt;
    &lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/li&gt;

  &lt;li&gt;Subscribe to the ManipulationDelta event in the UI Element (or an element higher in the Visual tree, since the event is routed).&amp;#160; ManipulationDelta is where all the action happens.&amp;#160; I have included a “default” implementation below, with good commenting. 
    &lt;br /&gt;

    &lt;pre style="background-color: #efefef" class="code"&gt;&lt;span style="color: blue"&gt;void &lt;/span&gt;image_ManipulationDelta(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;ManipulationDeltaEventArgs &lt;/span&gt;e)
{
    &lt;span style="color: green"&gt;//this just gets the source. 
    // I cast it to FE because I wanted to use ActualWidth for Center. You could try RenderSize as alternate
    &lt;/span&gt;&lt;span style="color: blue"&gt;var &lt;/span&gt;element = e.Source &lt;span style="color: blue"&gt;as &lt;/span&gt;&lt;span style="color: #2b91af"&gt;FrameworkElement&lt;/span&gt;; 
    &lt;span style="color: blue"&gt;if &lt;/span&gt;( element != &lt;span style="color: blue"&gt;null &lt;/span&gt;) 
    { 
        &lt;span style="color: green"&gt;//e.DeltaManipulation has the changes 
        // Scale is a delta multiplier; 1.0 is last size,  (so 1.1 == scale 10%, 0.8 = shrink 20%) 
        // Rotate = Rotation, in degrees
        // Pan = Translation, == Translate offset, in Device Independent Pixels 
         
        &lt;/span&gt;&lt;span style="color: blue"&gt;var &lt;/span&gt;deltaManipulation = e.DeltaManipulation; 
        &lt;span style="color: blue"&gt;var &lt;/span&gt;matrix  = ((&lt;span style="color: #2b91af"&gt;MatrixTransform&lt;/span&gt;)element.RenderTransform).Matrix;            
        &lt;span style="color: green"&gt;// find the old center; arguaby this could be cached 
        &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Point &lt;/span&gt;center =  &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Point &lt;/span&gt;( element.ActualWidth/&lt;span style="color: brown"&gt;2&lt;/span&gt;, element.ActualHeight/&lt;span style="color: brown"&gt;2&lt;/span&gt;) ;
        &lt;span style="color: green"&gt;// transform it to take into account transforms from previous manipulations 
        &lt;/span&gt;center = matrix.Transform(center); 
        &lt;span style="color: green"&gt;//this will be a Zoom. 
        &lt;/span&gt;matrix.ScaleAt(deltaManipulation.Scale.X, deltaManipulation.Scale.Y, center.X, center.Y); 
        &lt;span style="color: green"&gt;// Rotation 
        &lt;/span&gt;matrix.RotateAt(e.DeltaManipulation.Rotation, center.X, center.Y);             
        &lt;span style="color: green"&gt;//Translation (pan) 
        &lt;/span&gt;matrix.Translate(e.DeltaManipulation.Translation.X, e.DeltaManipulation.Translation.Y);

        ((&lt;span style="color: #2b91af"&gt;MatrixTransform&lt;/span&gt;)element.RenderTransform).Matrix = matrix; 

        e.Handled = &lt;span style="color: blue"&gt;true&lt;/span&gt;;
    }
}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;
    &lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;
  &lt;br /&gt;That is how simple manipulation is. All the raw-touch data, translated into these simple Delta Matrixes!&amp;#160;&amp;#160; &lt;br /&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Enhancing Manipulation with Inertia&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Inertia adds physics to a manipulation to make it feel more natural.&amp;#160; As expected, it works on all UI elements that support manipulation. The way to think of inertia is that it carries through the physical momentum of a manipulation. For example, if you are implementing a translation manipulation that is moving an image across the X-axis, inertia will continue the manipulation a bit longer than the actual manipulation contact and it would decelerate at a speed you define, simulating the momentum and the friction to stop the translation. &lt;/p&gt;

&lt;p&gt;To add support for inertia, we simply update our old code and listen to a new event and then add code to handle inertia on our manipulation Delta.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Subscribe to ManipulationInertiaStarting.&amp;#160; &lt;br /&gt;This event is similar to ManipulationStarting, it gets called at the beginning of each individual manipulation. In the event handler we append parameters to the Manipulation. For inertia, the interesting properties include: 

    &lt;ul&gt;
      &lt;li&gt;&lt;em&gt;ExpansionBehavior – &lt;/em&gt;decelerates at DIPs per squared millisecond .&amp;#160; &lt;/li&gt;

      &lt;li&gt;&lt;em&gt;TranslationBehavior&amp;#160; &lt;/em&gt;- decelerates at DIPs per millisecond. &lt;/li&gt;

      &lt;li&gt;&lt;em&gt;RotationBehavior - &lt;/em&gt;decelerates at degrees per millisecond 

        &lt;br /&gt;&lt;/li&gt;

      &lt;li&gt;&lt;em&gt;InitialVelocities &lt;/em&gt;is read-only; it gives you the velocities calculated from the previous stage of the manipulation. You can use these values to calculate your own behaviors.&amp;#160; &lt;br /&gt;

        &lt;br /&gt;&lt;a href="http://blogs.msdn.com/blogfiles/jaimer/WindowsLiveWriter/IntroductiontoWPF4Multitouch_12FBA/image_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/jaimer/WindowsLiveWriter/IntroductiontoWPF4Multitouch_12FBA/image_thumb.png" width="625" height="439" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;

        &lt;br /&gt;Here is the code to add our desired behaviors for inertia: 

        &lt;br /&gt;

        &lt;br /&gt;

        &lt;pre style="background-color: #efefef" class="code"&gt;&lt;span style="color: blue"&gt;void &lt;/span&gt;canvas_ManipulationInertiaStarting(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;ManipulationInertiaStartingEventArgs &lt;/span&gt;e)
{                
        &lt;span style="color: green"&gt;// Decrease the velocity of the Rectangle's movement by 
        // 10 inches per second every second.
        // (10 inches * 96 DIPS per inch / 1000ms^2)
        &lt;/span&gt;e.TranslationBehavior = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;InertiaTranslationBehavior&lt;/span&gt;()
        {
            InitialVelocity = e.InitialVelocities.LinearVelocity,
            DesiredDeceleration = &lt;span style="color: brown"&gt;10.0 &lt;/span&gt;* &lt;span style="color: brown"&gt;96.0 &lt;/span&gt;/ (&lt;span style="color: brown"&gt;1000.0 &lt;/span&gt;* &lt;span style="color: brown"&gt;1000.0&lt;/span&gt;)
        };

        &lt;span style="color: green"&gt;// Decrease the velocity of the Rectangle's resizing by 
        // 0.1 inches per second every second.
        // (0.1 inches * 96 DIPS per inch / (1000ms^2)
        &lt;/span&gt;e.ExpansionBehavior = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;InertiaExpansionBehavior&lt;/span&gt;()
        {
            InitialVelocity = e.InitialVelocities.ExpansionVelocity,
            DesiredDeceleration = &lt;span style="color: brown"&gt;0.1 &lt;/span&gt;* &lt;span style="color: brown"&gt;96 &lt;/span&gt;/ &lt;span style="color: brown"&gt;1000.0 &lt;/span&gt;* &lt;span style="color: brown"&gt;1000.0
        &lt;/span&gt;};

        &lt;span style="color: green"&gt;// Decrease the velocity of the Rectangle's rotation rate by 
        // 2 rotations per second every second.
        // (2 * 360 degrees / (1000ms^2)
        &lt;/span&gt;e.RotationBehavior = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;InertiaRotationBehavior&lt;/span&gt;()
        {
            InitialVelocity = e.InitialVelocities.AngularVelocity,
            DesiredDeceleration = &lt;span style="color: brown"&gt;720 &lt;/span&gt;/ (&lt;span style="color: brown"&gt;1000.0 &lt;/span&gt;* &lt;span style="color: brown"&gt;1000.0&lt;/span&gt;)
        };
        e.Handled = &lt;span style="color: blue"&gt;true&lt;/span&gt;;                  
}&lt;/pre&gt;
        &lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/li&gt;

      &lt;li&gt;You may notice I did not override the ManipulationContainer. This is not required; it will reuse the ManipulationContainer we set during the ManipulationStarting event. 
        &lt;br /&gt;

        &lt;br /&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;

  &lt;li&gt;[Optional] Now, we could add code at our ManipulationDelta event handler for inertia.&amp;#160; &lt;br /&gt;This is optional, if you run the code at this point, inertia is already working, but you will notice there is no boundaries (the images fly off the screen).&amp;#160; So, just as an example, I will add code to handle the boundaries and stop the inertia when we reach the boundaries. 

    &lt;pre style="background-color: #efefef" class="code"&gt;&lt;span style="color: blue"&gt;void &lt;/span&gt;image_ManipulationDelta(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;ManipulationDeltaEventArgs &lt;/span&gt;e)
{
    // &lt;span style="color: green"&gt;…. this is the same code as above, in our manipulation delta.. &lt;br /&gt;&lt;/span&gt;        ((&lt;span style="color: #2b91af"&gt;MatrixTransform&lt;/span&gt;)element.RenderTransform).Matrix = matrix; 

        e.Handled = &lt;span style="color: blue"&gt;true&lt;/span&gt;;

        &lt;span style="color: green"&gt;// Here is the new code. &lt;br /&gt;        // We are only checking boundaries during inertia in real world, we would check all the time &lt;br /&gt;&lt;/span&gt;&lt;span style="color: green"&gt;
        &lt;/span&gt;&lt;span style="color: blue"&gt;if &lt;/span&gt;(e.IsInertial)
        {
            &lt;span style="color: #2b91af"&gt;Rect &lt;/span&gt;containingRect = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Rect&lt;/span&gt;(((&lt;span style="color: #2b91af"&gt;FrameworkElement&lt;/span&gt;)e.ManipulationContainer).RenderSize);

            &lt;span style="color: #2b91af"&gt;Rect &lt;/span&gt;shapeBounds = element.RenderTransform.TransformBounds(&lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Rect&lt;/span&gt;(element.RenderSize));

            &lt;span style="color: green"&gt;// Check if the element is completely in the window.
            // If it is not and intertia is occurring, stop the manipulation.
            &lt;/span&gt;&lt;span style="color: blue"&gt;if &lt;/span&gt;(e.IsInertial &amp;amp;&amp;amp; !containingRect.Contains(shapeBounds))
            {
                &lt;span style="color: green"&gt;//Report that we have gone over our boundary 
                &lt;/span&gt;e.ReportBoundaryFeedback(e.DeltaManipulation); 
                &lt;span style="color: green"&gt;// comment out this line to see the Window 'shake' or 'bounce' 
                // similar to Win32 Windows when they reach a boundary; this comes for free in .NET 4                
                &lt;/span&gt;e.Complete();
            }
        }          
    }
}
&lt;font color="#0000ff"&gt; &lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;u&gt;&lt;/u&gt;&lt;/pre&gt;

    &lt;pre class="code"&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;That is it. Our image viewer now has inertia support, and we have full control on the deceleration, rotation ratios, etc. &lt;/pre&gt;
  &lt;/li&gt;
&lt;/ol&gt;
&lt;a href="manipulationdemo"&gt;A sample application for Manipulation and Inertia: &lt;/a&gt;

&lt;blockquote&gt;
  &lt;p&gt;Image Viewer. &lt;a href="http://blogs.msdn.com/blogfiles/jaimer/WindowsLiveWriter/IntroductiontoWPF4Multitouch_12FBA/Manipulation_8.png"&gt;&lt;img style="border-right-width: 0px; margin: 0px 60px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Manipulation" border="0" alt="Manipulation" align="right" src="http://blogs.msdn.com/blogfiles/jaimer/WindowsLiveWriter/IntroductiontoWPF4Multitouch_12FBA/Manipulation_thumb_3.png" width="313" height="220" /&gt;&lt;/a&gt; 

    &lt;br /&gt;This sample uses the code above to manipulate the images on the canvas.&amp;#160; &lt;br /&gt;

    &lt;br /&gt;Download the &lt;a href="http://www.cookingwithxaml.com/recipes/wpf4/wpf4touch.zip"&gt;source code&lt;/a&gt;.&amp;#160; &lt;br /&gt;&lt;/p&gt;

  &lt;p&gt;The viewer supports scaling, translating, and rotating the images, using multitouch gestures. There is also inertia support as you execute any manipulation. 
    &lt;br /&gt;

    &lt;br /&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&amp;#160; &lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mixing and matching approaches: 
    &lt;br /&gt;&lt;/strong&gt;

  &lt;br /&gt;In WPF 4 raw-touch and manipulation are not mutually exclusive –this is different from Win32.&amp;#160; &lt;br /&gt;You can enable both raw touch and manipulation at the same time on any UI Element.&amp;#160;&amp;#160; &lt;br /&gt;

  &lt;br /&gt;The table below explains how logic is handled for scenarios with different options enabled. &lt;/p&gt;

&lt;table border="1" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;
    &lt;tr&gt;
      &lt;td valign="top" width="96"&gt;
        &lt;p&gt;&lt;b&gt;Manipulations Enabled&lt;/b&gt;&lt;/p&gt;
      &lt;/td&gt;

      &lt;td valign="top" width="90"&gt;
        &lt;p&gt;&lt;b&gt;TouchDown is Handled&lt;/b&gt;&lt;/p&gt;
      &lt;/td&gt;

      &lt;td valign="top" width="114"&gt;
        &lt;p&gt;&lt;b&gt;GotTouchCapture is Handled&lt;/b&gt;&lt;/p&gt;
      &lt;/td&gt;

      &lt;td valign="top" width="174"&gt;
        &lt;p&gt;&lt;b&gt;User Logic&lt;/b&gt;&lt;/p&gt;
      &lt;/td&gt;

      &lt;td valign="top" width="193"&gt;
        &lt;p&gt;&lt;b&gt;WPF Logic&lt;/b&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="96"&gt;
        &lt;p&gt;None&lt;/p&gt;
      &lt;/td&gt;

      &lt;td valign="top" width="90"&gt;
        &lt;p&gt;No&lt;/p&gt;
      &lt;/td&gt;

      &lt;td valign="top" width="114"&gt;
        &lt;p&gt;No&lt;/p&gt;
      &lt;/td&gt;

      &lt;td valign="top" width="174"&gt;
        &lt;p&gt;None&lt;/p&gt;
      &lt;/td&gt;

      &lt;td valign="top" width="193"&gt;
        &lt;p&gt;Promoted to Mouse&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="96"&gt;
        &lt;p&gt;None&lt;/p&gt;
      &lt;/td&gt;

      &lt;td valign="top" width="90"&gt;
        &lt;p&gt;Yes&lt;/p&gt;
      &lt;/td&gt;

      &lt;td valign="top" width="114"&gt;
        &lt;p&gt;No&lt;/p&gt;
      &lt;/td&gt;

      &lt;td valign="top" width="174"&gt;
        &lt;p&gt;Handled as Touch by user&lt;/p&gt;
      &lt;/td&gt;

      &lt;td valign="top" width="193"&gt;
        &lt;p&gt;None&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="96"&gt;
        &lt;p&gt;None&lt;/p&gt;
      &lt;/td&gt;

      &lt;td valign="top" width="90"&gt;
        &lt;p&gt;Yes&lt;/p&gt;
      &lt;/td&gt;

      &lt;td valign="top" width="114"&gt;
        &lt;p&gt;Yes&lt;/p&gt;
      &lt;/td&gt;

      &lt;td valign="top" width="174"&gt;
        &lt;p&gt;Handled as Touch by user&lt;/p&gt;
      &lt;/td&gt;

      &lt;td valign="top" width="193"&gt;
        &lt;p&gt;None&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="96"&gt;
        &lt;p&gt;&lt;i&gt;Enabled&lt;/i&gt;&lt;/p&gt;
      &lt;/td&gt;

      &lt;td valign="top" width="90"&gt;
        &lt;p&gt;No&lt;/p&gt;
      &lt;/td&gt;

      &lt;td valign="top" width="114"&gt;
        &lt;p&gt;No&lt;/p&gt;
      &lt;/td&gt;

      &lt;td valign="top" width="174"&gt;
        &lt;p&gt;None&lt;/p&gt;
      &lt;/td&gt;

      &lt;td valign="top" width="193"&gt;
        &lt;p&gt;1. Handled by Manipulation logic, TouchDevice is Captured,&lt;/p&gt;

        &lt;p&gt;2. Manipulation logic will handle GotTouchCapture event and manipulation events will be reported&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="96"&gt;
        &lt;p&gt;&lt;i&gt;Enabled&lt;/i&gt;&lt;/p&gt;
      &lt;/td&gt;

      &lt;td valign="top" width="90"&gt;
        &lt;p&gt;Yes&lt;/p&gt;
      &lt;/td&gt;

      &lt;td valign="top" width="114"&gt;
        &lt;p&gt;No&lt;/p&gt;
      &lt;/td&gt;

      &lt;td valign="top" width="174"&gt;
        &lt;p&gt;Handled as Touch by user. User has to explicitly capture the touch device. &lt;/p&gt;
      &lt;/td&gt;

      &lt;td valign="top" width="193"&gt;
        &lt;p&gt;Manipulation logic will handle GotTouchCapture event and manipulation events will be reported&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="96"&gt;
        &lt;p&gt;&lt;i&gt;Enabled&lt;/i&gt;&lt;/p&gt;
      &lt;/td&gt;

      &lt;td valign="top" width="90"&gt;
        &lt;p&gt;Yes&lt;/p&gt;
      &lt;/td&gt;

      &lt;td valign="top" width="114"&gt;
        &lt;p&gt;Yes&lt;/p&gt;
      &lt;/td&gt;

      &lt;td valign="top" width="174"&gt;
        &lt;p&gt;1. Handled as Touch by User.&lt;/p&gt;

        &lt;p&gt;2. User has to explicity capture the touch device.&lt;/p&gt;

        &lt;p&gt;3. GotCapture handled by user, user has to explicitly AddManipulator to invoke manipulation&lt;/p&gt;
      &lt;/td&gt;

      &lt;td valign="top" width="193"&gt;
        &lt;p&gt;None&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;&lt;/table&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;Summary 
      &lt;br /&gt;&lt;/strong&gt;&lt;/u&gt;

  &lt;br /&gt;This tutorial provided a basic introduction to multitouch in WPF. As you have seen, WPF supports both raw-touch and manipulation (with inertia) for all WPF UI elements.&amp;#160; &lt;br /&gt;

  &lt;br /&gt;Using WPF’s new touch support, you can accomplish quite a bit with just a few lines of code. The support compliments and integrates quite well with the platform. &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9915764" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jaimer/archive/tags/Windows+Presentation+Foundation/default.aspx">Windows Presentation Foundation</category><category domain="http://blogs.msdn.com/jaimer/archive/tags/Windows+7/default.aspx">Windows 7</category><category domain="http://blogs.msdn.com/jaimer/archive/tags/touch/default.aspx">touch</category></item><item><title>WPF discussions, 091101</title><link>http://blogs.msdn.com/jaimer/archive/2009/11/02/wpf-discussions-091101.aspx</link><pubDate>Mon, 02 Nov 2009 08:16:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9916056</guid><dc:creator>jaimer</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/jaimer/comments/9916056.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jaimer/commentrss.aspx?PostID=9916056</wfw:commentRss><description>&lt;P&gt;As usual, raw, unedited, useful info from the Microsoft’s internal WPF discussions lists. 
&lt;HR&gt;
&lt;B&gt;Subject:&lt;/B&gt; All keys don't work in a WPF window when it is calling from a WinForm project. &lt;BR&gt;We had a big project developed in WinForm. Now I'm adding a new window to the project using WPF. The WPF window is now part of the project, i.e. it is not a separate project or dll. What happened now is any control that is supposed to accept keyboard inputs, such as textbox, does not respond to my keyboard input. The window only responds to mouse. 
&lt;P&gt;&lt;FONT color=#008000&gt;&lt;STRONG&gt;Answer: &lt;BR&gt;&lt;/STRONG&gt;You must use call the &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/system.windows.forms.integration.elementhost.enablemodelesskeyboardinterop.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/system.windows.forms.integration.elementhost.enablemodelesskeyboardinterop.aspx"&gt;&lt;FONT color=#008000&gt;EnableModelessKeyboardInterop&lt;/FONT&gt;&lt;/A&gt;&lt;FONT color=#008000&gt; method for keyboard to work. &lt;BR&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;HR&gt;
&lt;STRONG&gt;Subject: Precision on WPF animations&lt;BR&gt;&lt;/STRONG&gt;This question was from a partner. they have some synchronization issue between their own animation and WPF animation. The difference of ~0.2 can happen because WPF animation precision depends on rendering timing, doesn’t it ? 
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color=#008000&gt;Answer:&lt;/FONT&gt; &lt;BR&gt;&lt;/STRONG&gt;&lt;FONT color=#008000&gt;That's right - we do a number of things to sync with rendering.&amp;nbsp; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#008000&gt;Time only "changes" at the start of a render pass, which is scheduled differently based on a number of factors (Desktop Window Manager present and enabled? Monitor refresh rate, desired framerate for animations, etc), and then too the time chosen is actually "in the future" a bit because we're trying to produce a set of changes that will be correct &lt;EM&gt;when they hit the screen&lt;/EM&gt;.&amp;nbsp; To do this, we estimate the future presentation time for a given UI thread's render pass.&amp;nbsp; My guess is that this is what they're seeing in this case&lt;/FONT&gt;&lt;/P&gt;
&lt;HR&gt;
&lt;B&gt;Subject:&lt;/B&gt;&amp;nbsp; Using Blend Behavior in Style? &lt;BR&gt;Why am I getting an error when setting a Behavior in a style. Isn’t Blend Interaction an AttachedProperty? 
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color=#008000&gt;Answer:&lt;BR&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT color=#008000&gt;Blend’s behaviors are an attached property, but publicly they are not exposed as a DP- you can do attached properties that are not DP’s by having just the static GetProperty/SetProperty.&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#008000&gt;We use this syntax to keep the behavior syntax smaller- by not using a real DP here we were able to default the collection to having a value and remove 2 lines of XAML. If this were a real DP then you’d have to add the collection to the XAML as well:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;&amp;lt;Button&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;&amp;nbsp; &amp;lt;i:Interaction.Behaviors&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;&amp;lt;i:BehaviorCollection&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;s:SimpleBehavior/&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;&amp;lt;/i:BehaviorCollection&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;&amp;nbsp; &amp;lt;/i:Interaction.Behaviors&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;&amp;lt;/Button&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;In addition behaviors cannot be used inside of styles; the core issue is that we intentionally made behaviors not sharable- you can’t apply the same behavior to multiple elements. The reason is that if you use the WPF animation API as an example that it adds a ton of complexity to make the types sharable and it really detracts from the level of simplicity that we were looking for in Behaviors.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;In WPF, everything applied through a style is shared&amp;nbsp; across each element that it’s applied to. To get around this in early prototypes I used a trick with Freezables and the CoerceValueCallback to clone the behaviors every time they’re applied to an element and are already applied to something else, but none of this is present in SL and it can lead to some unexpected runtime behavior.&lt;/FONT&gt;&lt;/P&gt;
&lt;HR&gt;
&lt;B&gt;Subject:&lt;/B&gt; Best Match for ICO in WPF? &lt;BR&gt;Is there a built-in way in the WPF 4.0 imaging classes to get a “best match” for a multi-frame ICO? 
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color=#008000&gt;Answer:&lt;BR&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT color=#008000&gt;We don’t have any automatic selection logic. You can iterate over all of the frames and find the one you want based upon each frame’s properties. You should be able to get them all from a frame by doing frame.Decoder.Frames. Alternatively, you can just do BitmapDecoder.Create and read the frames that way rather than indirectly through BitmapFrame.Create.&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#008000&gt;Note: pre-Win7 WIC does not support Vista’s PNG icon frames. If you hit a PNG frame you will get an exception on Vista and XP.&lt;/FONT&gt;&lt;/P&gt;
&lt;HR&gt;
&lt;B&gt;Subject:&lt;/B&gt; Binding and Custom Type Descriptors &lt;BR&gt;In WPF we’re binding an object that has a custom type descriptor and are wondering if there is a way to get around a couple issues: 
&lt;P&gt;1. Is there a way to get WPF to listen to these changes given that WPF does not appear to subscribe to change events via PropertyDescriptor.AddValueChanged? &lt;BR&gt;It appears that WPF will bind to the properties offered through the type descriptor, but WPF does not monitor that type descriptor for value changes.&amp;nbsp;&amp;nbsp;&amp;nbsp; It does appear to listen to INotifyPropertyChanged events, but this is not that useful if we are extending and object with custom properties. &lt;/P&gt;
&lt;P&gt;2. Is there a way to have WPF bypass ICustomTypeDescriptor.GetProperties() when setting up a binding? In this case, custom types may hide the thing we actually want to bind to, so it would be useful to force WPF not to use the custom descriptor during binding.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color=#008000&gt;Answer:&lt;BR&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT color=#008000&gt;1. WPF &lt;I&gt;will&lt;/I&gt; listen to ValueChanged if the object doesn’t implement INotifyPropertyChanged.&amp;nbsp; If both are available we only listen to INPC, to avoid duplicate notifications.&amp;nbsp; There are objects that expose both – chiefly ADO.Net’s DataRowView – so it’s a real issue.&amp;nbsp;&amp;nbsp; If you have appropriate access, you can get the object to raise the PropertyChanged event with a property name for your custom property.&amp;nbsp; But if it’s not your object (and its OnPropertyChanged method is private), you’re out of luck.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;2. No.&amp;nbsp; We actually call TypeDescriptor.GetProperties(item), which in turn calls ICTD.GetProperties, so it’s out of our hands.&amp;nbsp; Usually people want the custom descriptor to override the native one;&amp;nbsp; we don’t have any way to ask for the other way around.&amp;nbsp; (I’m curious what your scenario is, though.&amp;nbsp; This is the first time someone’s asked for this.)&lt;/FONT&gt;&lt;/P&gt;
&lt;HR&gt;

&lt;P&gt;&lt;FONT color=#008000&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;B&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;&lt;B&gt;Subject:&lt;/B&gt; Binding to dictionary with multiple indexers &lt;BR&gt;If I add a second indexer to a collection class, it will no longer bind to WPF FrameworkElement such that its index path can be referenced. &lt;BR&gt;The following works fine on regular collection, But I add a second indexer, or if the collection is keyed, the binding no longer works:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Path=[0].&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color=#008000&gt;Answer: &lt;BR&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT color=#008000&gt;Your two indexers have different signatures, probably something like&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public object this[int index] { …}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public object this[string s] {…}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;The property path is declared in XAML, where everything is a string.&amp;nbsp; So when you say “Path=[0]”, WPF has to decide whether you mean the first indexer with argument (int)0, or the second indexer with argument (string)”0”.&amp;nbsp;&amp;nbsp; There’s nothing in the XAML to indicate which one you mean, so I think we choose the line of least resistance and pick the second indexer – it requires no type conversion.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;At any rate, you can provide the missing guidance by saying&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Path=[(sys:Int32)0]&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;assuming you’ve previously declared&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:sys=”clr-namespace:System;assembly=mscorlib”&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;This says what you think it does:&amp;nbsp; “use the indexer that takes an int argument”.&lt;/FONT&gt;&lt;/P&gt;
&lt;HR&gt;

&lt;P&gt;&lt;B&gt;Subject:&lt;/B&gt; SketchFlow transitions between screens? &lt;BR&gt;Is it possible to create transitions between screens in SketchFlow?&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color=#008000&gt;Answer: &lt;BR&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT color=#008000&gt;It should be doing this by default. The default transition is a fade, if you right-click a navigation connection in the map, there are a few more to choose from “Transition Styles”.&lt;/FONT&gt; &lt;/P&gt;
&lt;HR&gt;

&lt;P&gt;&lt;B&gt;Subject:&lt;/B&gt; RE: How to improve the text rendering of your .NET 4.0 WPF Applications&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;&lt;STRONG&gt;Answer: &lt;BR&gt;&lt;/STRONG&gt;Important caveat: Do not use TextFormattingMode=”Display” on text that is going to be scaled by a RenderTransform (or scaled in any way other than by changing the font size). It will end up blurry. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;Some more recommendations: &lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/text/archive/2009/08/24/wpf-4-0-text-stack-improvements.aspx" mce_href="http://blogs.msdn.com/text/archive/2009/08/24/wpf-4-0-text-stack-improvements.aspx"&gt;&lt;FONT color=#008000&gt;http://blogs.msdn.com/text/archive/2009/08/24/wpf-4-0-text-stack-improvements.aspx&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;HR&gt;

&lt;P&gt;&lt;B&gt;Subject:&lt;/B&gt; RE: Partner's question about WPF-Image convert &amp;amp; Flash support&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color=#008000&gt;Answer:&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;There are external EMF-&amp;gt;XAML converters:&lt;BR&gt;&lt;/FONT&gt;&lt;A href="http://www.wpf-graphics.com/Paste2Xaml.aspx" mce_href="http://www.wpf-graphics.com/Paste2Xaml.aspx"&gt;&lt;FONT color=#008000&gt;http://www.wpf-graphics.com/Paste2Xaml.aspx&lt;/FONT&gt;&lt;/A&gt;&lt;BR&gt;&lt;A href="http://www.verydoc.com/emf2vector/emf-to-xps.html" mce_href="http://www.verydoc.com/emf2vector/emf-to-xps.html"&gt;&lt;FONT color=#008000&gt;http://www.verydoc.com/emf2vector/emf-to-xps.html&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;Indeed, WPF does not provide any native flash rendering.&amp;nbsp; I doubt we ever will.&amp;nbsp; Some options: &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#008000&gt;1) Host a web browser.&amp;nbsp; Yes this is HWND interop code, so there are some compromises: the infamous airspace issues being the most prominent.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;2) For display only, you might look at a DirectShow filter, like: &lt;/FONT&gt;&lt;A href="http://www.medialooks.com/products/directshow_filters/flash_source.html" mce_href="http://www.medialooks.com/products/directshow_filters/flash_source.html"&gt;&lt;FONT color=#008000&gt;http://www.medialooks.com/products/directshow_filters/flash_source.html&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;HR&gt;

&lt;P&gt;&lt;B&gt;Subject:&lt;/B&gt; Property increment value i nBlend &lt;BR&gt;If you expose a numeric property on a type and it is available in the&amp;nbsp; property window you can change the value by dragging the cursor up, down, left and right.&amp;nbsp; Is there a way to tell Blend what the incremental value should be?&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color=#008000&gt;Answer:&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;Yes, you need to supply a design-time assembly that uses the NumberIncrementsAttribute. &lt;BR&gt;&lt;BR&gt;&lt;/FONT&gt;
&lt;TABLE border=0 cellSpacing=0 cellPadding=0&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD vAlign=top&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;public sealed class &lt;B&gt;&lt;A href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://Microsoft.Windows.Design.Interaction:4.0.0.0:b03f5f7f11d50a3a/Microsoft.Windows.Design.PropertyEditing.NumberIncrementsAttribute" mce_href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://Microsoft.Windows.Design.Interaction:4.0.0.0:b03f5f7f11d50a3a/Microsoft.Windows.Design.PropertyEditing.NumberIncrementsAttribute"&gt;NumberIncrementsAttribute&lt;/A&gt;&lt;/B&gt; : &lt;/FONT&gt;&lt;A href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Attribute" mce_href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Attribute"&gt;&lt;FONT color=#008000&gt;Attribute&lt;/FONT&gt;&lt;/A&gt;&lt;FONT color=#008000&gt;, &lt;/FONT&gt;&lt;A href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://Microsoft.Windows.Design.Interaction:4.0.0.0:b03f5f7f11d50a3a/Microsoft.Windows.Design.PropertyEditing.IIndexableAttribute" mce_href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://Microsoft.Windows.Design.Interaction:4.0.0.0:b03f5f7f11d50a3a/Microsoft.Windows.Design.PropertyEditing.IIndexableAttribute"&gt;&lt;FONT color=#008000&gt;IIndexableAttribute&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;TABLE border=0 cellSpacing=0 cellPadding=0&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD vAlign=top width="8%"&gt;
&lt;P&gt;&lt;B&gt;&lt;FONT color=#008000&gt;Name:&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD vAlign=top&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;Microsoft.Windows.Design.PropertyEditing.NumberIncrementsAttribute&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD vAlign=top width="8%"&gt;
&lt;P&gt;&lt;B&gt;&lt;FONT color=#008000&gt;Assembly:&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD vAlign=top&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;Microsoft.Windows.Design.Interaction, Version=4.0.0.0&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/unnir/archive/2009/03/22/writing-a-design-time-experience-for-a-silverlight-control.aspx" mce_href="http://blogs.msdn.com/unnir/archive/2009/03/22/writing-a-design-time-experience-for-a-silverlight-control.aspx"&gt;&lt;FONT color=#008000&gt;http://blogs.msdn.com/unnir/archive/2009/03/22/writing-a-design-time-experience-for-a-silverlight-control.aspx&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;HR&gt;

&lt;P&gt;&lt;B&gt;Subject:&lt;/B&gt; pack: registration?&lt;/P&gt;
&lt;P&gt;I forget, how do you open a pack: URI? &lt;BR&gt;I tried using WebRequest.Create, but that gave me an error saying that pack: wasn’t registered… Then I tried using PackUriHelper to cause it’s static cctor to run, to try and get the prefix registered… PackWebRequest isn’t constructable (from what I can see)… &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color=#008000&gt;Answer:&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;[Multiple interesting data points] &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;#1 System.Windows.Application has a static ctor where ResourceContainer package is added to PreloadedPackages so that downstream PackWebRequestFactory can find it. So you need to be running in the context of an Avalon application to get this.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;#2&amp;nbsp; If you use PackUriHelper class, the “pack:” prefix gets registered with the System.Uri class and this helps in performing the correct parsing and construction of System.Uri objects for pack Uris.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;The other registration is of the pack: scheme with WebRequest so that you can use WebRequest.Create method to return the PackWebRequest object. This can be done in your code. PackWebRequestFactory does not register it. You could use PackWebRequestFactory directly to get the PackWebRequest too –&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;PackWebRequest request = (PackWebRequest)((IWebRequestCreate)new PackWebRequestFactory()).Create(packUri);&lt;/FONT&gt;&lt;/P&gt;
&lt;HR&gt;

&lt;P&gt;&lt;STRONG&gt;Subject:&lt;/STRONG&gt; RichTextBox viewable area&lt;/P&gt;
&lt;P&gt;Is there any way to get the viewable area in a RichTextBox?&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color=#008000&gt;Answer: &lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;TextPointer upperLeftCorner = rtb.GetPositionFromPoint(new Point(0, 0), true /* snapToText */); TextPointer lowerRightCorner = rtb.GetPositionFromPoint(new Point(rtb.ActualWidth, rtb.ActualHeight), true /* snapToText */);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;You could refine this to get a tighter fit by looking at RichTextBox.ViewportWidth/ViewportHeight, to omit space for surrounding chrome like the possibly visible ScollViewer or Border. But for optimizing a property set on the viewable area first, including a small amount of extra content around the viewport is probably fine.&lt;/FONT&gt;&lt;/P&gt;
&lt;HR&gt;

&lt;P&gt;&lt;B&gt;Subject:&lt;/B&gt; ValidatesOnDataErrors not working on bindings inside an ItemsControl.&lt;/P&gt;
&lt;P&gt;I noticed that ValidatesOnDataErrors is not working on bindings inside an ItemsControl.ItemTemplate. I confirmed this problem has been fixed in Framework 4.0 but our target is 3.5.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color=#008000&gt;Answer: &lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;the workaround is to use the “long” form of ValidatesOnDataErrors:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;&amp;lt;Binding.ValidationRules&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;DataErrorValidationRule/&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;&amp;lt;/Binding.ValidationRules&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#008000&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR&gt;

&lt;P&gt;Happy coding!! &lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9916056" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jaimer/archive/tags/Windows+Presentation+Foundation/default.aspx">Windows Presentation Foundation</category><category domain="http://blogs.msdn.com/jaimer/archive/tags/wpfdiscussion/default.aspx">wpfdiscussion</category></item><item><title>What is new in WPF and Cider on the .NET Framework 4 and VS2010 beta 2 release</title><link>http://blogs.msdn.com/jaimer/archive/2009/10/23/what-is-new-in-wpf-and-cider-on-the-net-framework-4-and-vs2010-beta-2-release.aspx</link><pubDate>Fri, 23 Oct 2009 14:39:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9912080</guid><dc:creator>jaimer</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/jaimer/comments/9912080.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jaimer/commentrss.aspx?PostID=9912080</wfw:commentRss><description>&lt;P&gt;This post is a quick recap of the most important changes for WPF and Silverlight developers in this Beta 2 release. I definitely will return to a few of these topics over the next few weeks, so stay tuned for updates and new posts. Please note that this post is NOT all-inclusive; there are lots of features and smaller bug fixes that I am leaving out. I will try to dig those up as we go along in the next few weeks! &lt;/P&gt;
&lt;P&gt;Also, I've listed links to the Beta 1 posts at the bottom of the post for those needing a refresh. I've also sprinkled links to the videos in our “WPF in VS2010 Beta 2 series” throughout the post, as well as listing them at the end. &lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&lt;STRONG&gt;New in the Visual Studio 2010 Cider designer&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;You can see a video with most of the Beta 2 updates &lt;A href="http://channel9.msdn.com/posts/Jaime+Rodriguez/Whats-new-in-the-WPF-and-Silverlight-Cider-Designer-in-VS2010-beta2/" target=_blank mce_href="http://channel9.msdn.com/posts/Jaime+Rodriguez/Whats-new-in-the-WPF-and-Silverlight-Cider-Designer-in-VS2010-beta2/"&gt;in this 14 minute video with Mark Wilson Thomas&lt;/A&gt;. &lt;BR&gt;In the video, Mark shares a MUST USE registry key to improve the performance of Visual Studio 2010 Beta 2. &lt;BR&gt;&lt;BR&gt;For the record, this is in the readme, it is not a hack and Mark has documented it on his &lt;A href="http://social.msdn.microsoft.com/Forums/en-US/vswpfdesigner/thread/4bda432a-4e18-4fb5-a257-15c0e653b3a9" target=_blank mce_href="http://social.msdn.microsoft.com/Forums/en-US/vswpfdesigner/thread/4bda432a-4e18-4fb5-a257-15c0e653b3a9"&gt;announcement&lt;/A&gt;:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;STRONG&gt;Registry Switch for improved performance &lt;BR&gt;&lt;/STRONG&gt;Because of a late-breaking change, you will need to make a configuration change to see the best designer performance. This configuration change will not be necessary in the final released versions of the product. &lt;BR&gt;&lt;STRONG&gt;NOTE:&lt;/STRONG&gt; Editing the registry can cause serious problems that may require you to reinstall Windows. Microsoft cannot guarantee that problems resulting from the incorrect use of Registry Editor can be solved. Use Registry Editor at your own risk. Refer to the article on registry editing for your OS (e.g &lt;A href="http://support.microsoft.com/kb/136393" mce_href="http://support.microsoft.com/kb/136393"&gt;http://support.microsoft.com/kb/136393&lt;/A&gt;) for advice.&amp;nbsp; &lt;BR&gt;&lt;EM&gt;1. Close any open VS instances &lt;BR&gt;2. Open RegEdit (as an administrator as needed) &lt;BR&gt;3. Select the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0 key &lt;BR&gt;4. Right click and add key, type ClrHost &lt;BR&gt;5. In the newly created key, right click and add a DWORD32 with the name StartupFlags &lt;BR&gt;6. Set its value to 5 &lt;BR&gt;7. Close RegEdit &lt;BR&gt;8. Start up Visual Studio and use as normal &lt;BR&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;EM&gt;[&lt;U&gt;10/28 update&lt;/U&gt;. Mark now has a &lt;A href="http://social.msdn.microsoft.com/Forums/en-US/vswpfdesigner/thread/4511d43f-c134-4329-a970-e374252a620e" mce_href="http://social.msdn.microsoft.com/Forums/en-US/vswpfdesigner/thread/4511d43f-c134-4329-a970-e374252a620e"&gt;disclaimer&lt;/A&gt;&amp;nbsp;and it is in bold red on his page, so it must be important, go read &lt;A href="http://social.msdn.microsoft.com/Forums/en-US/vswpfdesigner/thread/4511d43f-c134-4329-a970-e374252a620e" mce_href="http://social.msdn.microsoft.com/Forums/en-US/vswpfdesigner/thread/4511d43f-c134-4329-a970-e374252a620e"&gt;it&lt;/A&gt;: &lt;/EM&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;EM&gt;The registry hack might create instability or increased Virtual Memory Usage in some VS scenarios.&amp;nbsp; If you see this, feel free to remove the config change and report it on Connect. &lt;/EM&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;EM&gt;Also, if you are not using Cider designer a lot (for WPF and Silverlight) the configuration change is not helping you. So don't enable it unless you are using the designer a lot. &lt;/EM&gt;&lt;EM&gt;] &lt;/EM&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;Here are my cliff-notes from the video: &lt;BR&gt;&lt;BR&gt;For WPF developers&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;The designer continues to stabilize.&amp;nbsp; All the features introduced in Beta1 – including improvements on the designer, brush editor, IntelliSense on binding markup extensions, data sources window- have been cleaned up and the performance has been boosted.&amp;nbsp; &lt;BR&gt;&lt;/LI&gt;
&lt;LI&gt;The property browser has been updated with a new view that tells you what is the source for the value of a property (e.g. is the source set locally, from a style, binding, etc.).&amp;nbsp;&amp;nbsp; This feature is proving incredibly handy based just on my one week of using it! &lt;BR&gt;&lt;/LI&gt;
&lt;LI&gt;Support for StaticResources in app.xaml. Finally! No more long pack://application,,,/ syntax required. &lt;BR&gt;&lt;/LI&gt;
&lt;LI&gt;Improved error handling, much like Blend, where the designer can isolate errors to a specific user control; the designer now ‘recovers’ and gives you meaningful information about the error. &lt;BR&gt;&lt;/LI&gt;
&lt;LI&gt;Now there is design-time data support; compatible with Blend.&amp;nbsp; &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;For Silverlight developers, &lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;You finally get an interactive designer where you can drag &amp;amp; drop and get all the designer features available in WPF -&amp;nbsp; zero to 70 MPH in a single release- Cha-Ching!! &lt;BR&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;New Graphics (minus text) features for the WPF run-time?&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; You can &lt;A href="http://channel9.msdn.com/posts/Jaime+Rodriguez/Graphics-improvements-in-WPF-4/" target=_blank mce_href="http://channel9.msdn.com/posts/Jaime+Rodriguez/Graphics-improvements-in-WPF-4/"&gt;watch demos for most of these in this video with David&amp;nbsp; Teitlebaum&lt;/A&gt;.&amp;nbsp; You can get the demos for this video &lt;A href="http://www.cookingwithxaml.com/recipes/wpf4/graphics.zip" target=_blank mce_href="http://www.cookingwithxaml.com/recipes/wpf4/graphics.zip"&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;&lt;EM&gt;Cached Composition&lt;/EM&gt;&lt;/STRONG&gt;. This feature allows you to “cache” any UI Element as a bitmap that can be persisted in video memory. The cache supports dirty regions, so it redraws when needed (with out you needing to detect it).&amp;nbsp;&amp;nbsp; &lt;BR&gt;Cached elements can be live objects (e.g. a textblock) and can be transformed, rotated, etc. &lt;BR&gt;This feature is incredibly powerful for WPF scalability. If you watch David’s video you will see how he went from ~10fps on a live drawing, to 60fps when he cached it. I recently had a similar experience in a 3D viewer; my CPU decreased by 80% for all my drag &amp;amp; drops once I cached the 3D scene during the drags. &lt;BR&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/text/archive/2009/08/27/layout-rounding.aspx" target=_blank mce_href="http://blogs.msdn.com/text/archive/2009/08/27/layout-rounding.aspx"&gt;&lt;STRONG&gt;&lt;EM&gt;Layout Rounding&lt;/EM&gt;&lt;/STRONG&gt;&lt;/A&gt;&lt;STRONG&gt; &lt;/STRONG&gt;allows WPF to avoid the blurriness that results in images and text when they are using layout with sub-pixel positioning.&amp;nbsp; This feature is in Silverlight 2; again, nice to have compatibility. &lt;BR&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;EM&gt;&lt;STRONG&gt;Pixel Shader 3&lt;/STRONG&gt; &lt;STRONG&gt;support&lt;/STRONG&gt; &lt;/EM&gt;expands the effects pipeline significantly since PS3 has a lot more instructions.&amp;nbsp;A good reference on difference on # od instructions between PS2 and PS2 is at &lt;A href="http://en.wikipedia.org/wiki/High_Level_Shader_Language" mce_href="http://en.wikipedia.org/wiki/High_Level_Shader_Language"&gt;wikipedia&lt;/A&gt;.&lt;BR&gt;Note: The gotcha for this features is that Pixel Shader 3 does not default back to software rendering, so you will need to test to see if hardware supports the feature before you use it. &lt;BR&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;&lt;EM&gt;Animation easing functions &lt;/EM&gt;&lt;/STRONG&gt;allow designers to create more realistic, fluid animations. This feature matches the easing functions in Silverlight 3 and provides XAML compatibility.&amp;nbsp; Out of the box, you get&amp;nbsp; CircleEase, BackEase, ExponentialEase, Quadraticease, CubicEase, QuarticEase, Quinticease, PowerEase, Elasticease, BounceEase, and SineEase.&amp;nbsp; There is also an interface (IEasingFunction), so you can create your own easing functions and plug them into any of the existing animations via a new Dependency property on all stock animations.&amp;nbsp; &lt;BR&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;EM&gt;&lt;STRONG&gt;RenderOptions.ClearTypeHint &lt;/STRONG&gt;&lt;/EM&gt;allows you to turn ClearType on in scenarios where the system previously turned it off. &lt;BR&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;New Text Features &lt;BR&gt;&lt;/STRONG&gt;You can watch most of these improvements with insightful explanations in this &lt;A href="http://channel9.msdn.com/posts/Jaime+Rodriguez/New-Text-Stack-in-WPF-4/" target=_blank mce_href="http://channel9.msdn.com/posts/Jaime+Rodriguez/New-Text-Stack-in-WPF-4/"&gt;Channel9 video with Chipalo Street&lt;/A&gt;. &lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;A&lt;STRONG&gt;&lt;EM&gt; &lt;/EM&gt;&lt;/STRONG&gt;&lt;A href="http://blogs.msdn.com/text/archive/2009/08/24/wpf-4-0-text-stack-improvements.aspx" target=_blank mce_href="http://blogs.msdn.com/text/archive/2009/08/24/wpf-4-0-text-stack-improvements.aspx"&gt;&lt;STRONG&gt;&lt;EM&gt;new text rendering stack&lt;/EM&gt;&lt;/STRONG&gt;&lt;/A&gt; improves the clarity and puts&amp;nbsp; the application developer in control of the rendering and formating options. With this new stack you choose between the old world WPF text (which worked well for some scenarios), and new text with comparable sharpness to Win32/GDI.&amp;nbsp; &lt;BR&gt;Configuring the text enhancements is handled mostly via two new attached properties: &lt;BR&gt;&lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/text/archive/2009/08/24/wpf-4-0-text-stack-improvements.aspx" target=_blank mce_href="http://blogs.msdn.com/text/archive/2009/08/24/wpf-4-0-text-stack-improvements.aspx"&gt;TextOptions.TextFormatingMode&lt;/A&gt; allows you to control the metrics for formatting text. You get two options:&lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;Ideal – is the old WPF, the glyphs maintain high fidelity with their outlines, and placement of the final glyph is not taken into account &lt;/LI&gt;
&lt;LI&gt;Display – uses GDI compatible metrics and ensures glyph widths are in whole pixels (clarity of the text is much higher when text aligns to whole pixels) &lt;BR&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/text/archive/2009/08/24/wpf-4-0-text-stack-improvements.aspx" target=_blank mce_href="http://blogs.msdn.com/text/archive/2009/08/24/wpf-4-0-text-stack-improvements.aspx"&gt;TextOptions.TextRenderingMode&lt;/A&gt; allows you to control how the text is rendered. &lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;Auto – respects the system setting; this is usually ClearType for most systems &lt;/LI&gt;
&lt;LI&gt;ClearType – forces the rendering to Cleartype -this is what we were doing in earlier versions of WPF&lt;/LI&gt;
&lt;LI&gt;GrayScale – renders grayscale, antialiased text &lt;/LI&gt;
&lt;LI&gt;Aliased –&amp;nbsp; no antialiasing is used. &lt;BR&gt;Note: Per Chipalo, aliased vs. antialiased does not lead to perf differences; this surprised me. &lt;BR&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;
&lt;LI&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;A href="http://blogs.msdn.com/text/archive/2009/08/24/wpf-4-0-text-stack-improvements.aspx" target=_blank mce_href="http://blogs.msdn.com/text/archive/2009/08/24/wpf-4-0-text-stack-improvements.aspx"&gt;Embedded bitmaps&lt;/A&gt; &lt;/STRONG&gt;&lt;/EM&gt;adds support for (mostly) East Asian fonts that contain bitmaps for some characters at small sizes. &lt;BR&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;A href="http://blogs.msdn.com/text/archive/2009/09/01/bindable-run.aspx" target=_blank mce_href="http://blogs.msdn.com/text/archive/2009/09/01/bindable-run.aspx"&gt;Bindable Run&lt;/A&gt; &lt;/STRONG&gt;&lt;/EM&gt;is simply the old Run, fixed so that Run.Text is a dependency property and can be data bound. &lt;BR&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/text/archive/2009/09/01/caret-brush.aspx" target=_blank mce_href="http://blogs.msdn.com/text/archive/2009/09/01/caret-brush.aspx"&gt;&lt;EM&gt;&lt;STRONG&gt;Customization support for Caret Brush&lt;/STRONG&gt;&lt;/EM&gt;&lt;/A&gt;&lt;EM&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/EM&gt;allows you to replace the Caret in TextBox, PasswordBox and RichTextBox. You can replace the CaretBrush with any brush. Go crazy!&amp;nbsp; You can also customize SelectionBrush and SelectionOpacity on all controls that support selection –including TextBox, RichTextBox, PasswordBox, FlowDocumentPageViewer, FlowDocumentScrollViewer and FlowDocumentReader. &lt;BR&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/text/archive/2009/10/02/custom-dictionaries.aspx" target=_blank mce_href="http://blogs.msdn.com/text/archive/2009/10/02/custom-dictionaries.aspx"&gt;&lt;EM&gt;&lt;STRONG&gt;Custom Dictionaries&lt;/STRONG&gt;&lt;/EM&gt;&lt;/A&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;allows you to customize the dictionary used for spell checking in WPF applications. In previous releases, WPF used the OS dictionary, but did not allow you to extend it. Now with Custom dictionaries you can extend the dictionary to include your specialized industry lingo.&amp;nbsp; &lt;BR&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;New Control &amp;amp; Data binding features &lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;&lt;EM&gt;VisualStateManager &lt;/EM&gt;support&lt;/STRONG&gt;. VSM actually ships in the platform and all the controls have been tweaked to support Visual States. This means you can now customize Control templates using VSM and get higher compatibility with Silverlight. &lt;BR&gt;Note: Despite the VSM support in all the controls, the actual control templates were not changed, you will need to replace the template to use VSM. &lt;BR&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;&lt;EM&gt;Inheritance Context for Input Binding &lt;/EM&gt;&lt;/STRONG&gt;enables the MVVM scenario of&amp;nbsp; binding InputBinding.Command to a command in a ViewModel.&amp;nbsp; The Key and Modifiers property in KeyBinding are now Dependency Properties; same for MouseAction and MouseBinding. &lt;BR&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;&lt;EM&gt;DependencyObject.SetCurrentValue&amp;nbsp; &lt;/EM&gt;&lt;/STRONG&gt;is a new method introduced mostly for Custom Control authors.&amp;nbsp; SetCurrentValue method changes the effective value of the property, but existing triggers, data bindings, and styles will continue to work because the ValueSource for the property is not changed.&amp;nbsp; A lot of the controls in WPF were tweaked to use this, so their old SetValue calls were replaced with SetCurrentValue. I hear the recommendation is for custom control authors to use this method instead of SetValue; reccomendation makes sense, I am not sure if it applies 100% of the time, or just 99%; so use with 1% caution. &lt;BR&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;&lt;EM&gt;Databinding support for DynamicObjects.&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp; With .NET 4’s support for dynamic keyword, a lot of people will be using DynamicObject (and I DynamicMetaObjectProvider).&amp;nbsp; You will be able to bind to these dynamic objects using the same syntax than a property of any other object. You will even be able to use typed DataTemplates (as long as you are using concrete typesthat derive from DynamicObject.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;New Windows 7 features&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;&lt;EM&gt;MultiTouch &lt;/EM&gt;&lt;/STRONG&gt;is fully functional in Beta2. WPF now has full support for multitouch including&amp;nbsp; manipulation, inertia, and raw-touch events.&amp;nbsp;&amp;nbsp; The support is at UIElement, UIElement3D and ContentElement –which means every thing with LIFE in WPF supports Multitouch.&amp;nbsp; &lt;BR&gt;This topic is going to get its own blog post (and hopefully a video) soon, so stay tuned. &lt;BR&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;EM&gt;&lt;STRONG&gt;Taskbar &lt;/STRONG&gt;&lt;/EM&gt;support for Windows 7, including jumplists, progress bar, overlay icon, and thumbnail buttons (with WPF commanding support).&amp;nbsp; This topic will also get its own blog post soon. &lt;BR&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;Deployment update &lt;BR&gt;&lt;/STRONG&gt;You can watch a demo and get the whole picture from this Channel 9 &lt;A href="http://channel9.msdn.com/posts/Jaime+Rodriguez/NET-4-Client-Profile/" target=_blank mce_href="http://channel9.msdn.com/posts/Jaime+Rodriguez/NET-4-Client-Profile/"&gt;video interview with Jossef Goldberg&lt;/A&gt;. &lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;A href="http://blogs.msdn.com/jgoldb/archive/2009/10/19/what-s-new-in-net-framework-4-client-profile-beta-2.aspx" target=_blank mce_href="http://blogs.msdn.com/jgoldb/archive/2009/10/19/what-s-new-in-net-framework-4-client-profile-beta-2.aspx"&gt;Client profile&lt;/A&gt;&lt;/EM&gt; &lt;/STRONG&gt;is critical to the deployment of the framework outside of managed enterprises. By subsetting the full framework to a client SKU, we will decrease download size, and improve the framework install times.&amp;nbsp; &lt;BR&gt;In Beta 2, client profile is near feature complete: &lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;You can see it as its own separate, serviceable SKU&lt;/LI&gt;
&lt;LI&gt;The tools have support for it, including the References dialog in VS2010 filtering for assemblies only in client profile SKU if that is what you are targeting.&amp;nbsp; &lt;/LI&gt;
&lt;LI&gt;A few assemblies that were not in client profile SKU are now included, this increased the size to 30 MB, which is still a great improvement compared to full framework.&amp;nbsp; &lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Hopefully this gets you caught up on beta2.&amp;nbsp; Time to play! &lt;A href="http://www.microsoft.com/visualstudio/en-us/try/default.mspx#download" target=_blank mce_href="http://www.microsoft.com/visualstudio/en-us/try/default.mspx#download"&gt;Download visual Studio 2008 beta2&lt;/A&gt;.&amp;nbsp; Stay tuned for a few more posts on the topics above. &lt;/P&gt;
&lt;P&gt;LINK ROLL!! &lt;/P&gt;
&lt;P&gt;Beta 2 links: &lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="http://channel9.msdn.com/posts/Jaime+Rodriguez/Graphics-improvements-in-WPF-4/" target=_blank mce_href="http://channel9.msdn.com/posts/Jaime+Rodriguez/Graphics-improvements-in-WPF-4/"&gt;WPF 4 Graphics Improvements with David Teitlebaum&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://channel9.msdn.com/posts/Jaime+Rodriguez/New-Text-Stack-in-WPF-4/" target=_blank mce_href="http://channel9.msdn.com/posts/Jaime+Rodriguez/New-Text-Stack-in-WPF-4/"&gt;WPF 4 Text Improvements with Chipalo Street&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://channel9.msdn.com/posts/Jaime+Rodriguez/NET-4-Client-Profile/" target=_blank mce_href="http://channel9.msdn.com/posts/Jaime+Rodriguez/NET-4-Client-Profile/"&gt;What’s New in Client Profile with Jossef Goldberg&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://channel9.msdn.com/posts/Jaime+Rodriguez/Whats-new-in-the-WPF-and-Silverlight-Cider-Designer-in-VS2010-beta2/" target=_blank&gt;What’s New in Cider in VS2010 beta2 with Mark Wilson-Thomas&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Beta 1 (but still relevant links)&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="http://channel9.msdn.com/shows/Continuum/WPF4Beta1DesignerLookingForward/" target=_blank mce_href="http://channel9.msdn.com/shows/Continuum/WPF4Beta1DesignerLookingForward/"&gt;Cider in VS 2010 beta1&lt;/A&gt; has a long list of improvements for WPF and Silverlight developers in VS2010. All of these are still IN! &lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://channel9.msdn.com/shows/Continuum/MultitouchWPF4Beta1/" target=_blank mce_href="http://channel9.msdn.com/shows/Continuum/MultitouchWPF4Beta1/"&gt;Multitouch in WPF with Anson Tsao&lt;/A&gt;, this was recorded after Beta 1, so shows some Beta 2 roadmap/features.&lt;/LI&gt;&lt;/UL&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9912080" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jaimer/archive/tags/Windows+Presentation+Foundation/default.aspx">Windows Presentation Foundation</category><category domain="http://blogs.msdn.com/jaimer/archive/tags/silverlight/default.aspx">silverlight</category><category domain="http://blogs.msdn.com/jaimer/archive/tags/Windows+7/default.aspx">Windows 7</category><category domain="http://blogs.msdn.com/jaimer/archive/tags/VS2010/default.aspx">VS2010</category></item><item><title>More on AERO Shake and WPF</title><link>http://blogs.msdn.com/jaimer/archive/2009/10/19/more-on-aero-shake-and-wpf.aspx</link><pubDate>Mon, 19 Oct 2009 07:10:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9908941</guid><dc:creator>jaimer</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/jaimer/comments/9908941.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jaimer/commentrss.aspx?PostID=9908941</wfw:commentRss><description>&lt;p&gt;A few follow-up questions (and answers) from this &lt;a href="http://blogs.msdn.com/jaimer/archive/2009/10/14/implementing-aero-shake-in-a-windostyle-none-wpf-window.aspx"&gt;post&lt;/a&gt; on Aero shake in WPF Windowless apps . &lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;&lt;em&gt;The code I posted does not work if your WPF WindowStyle=None window is maximized. Why is that?&lt;/em&gt; &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;The shell detects the shake based on Windows movement, and when a window is maximized, it can not be dragged. This is a behavior defined by the shell :(&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;em&gt;Can’t you just ‘detect’ mouse move events and identify the shake gesture and then call the Shell’s API to do the shake? &lt;/em&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Unfortunately not.&amp;#160; The shell does not publicly expose APIs to implement the shake behavior – which is minimizing all windows except for the one that is being shaken-. &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;em&gt;Are we out of luck then to get Aero Shake on a ‘full screen’ app? &lt;/em&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;I think that simulating shake (several posts on the web that do that) is not ideal.&amp;#160; Those posts do it to bring Shake to earlier versions of Windows that do not have it.&amp;#160;&amp;#160; What I advised the person that did it was to not maximize their Window.&amp;#160; You can detect the available screen real-estate and size to that. &lt;/p&gt;    &lt;pre style="background-color: #e1f0f4" class="code"&gt;&lt;span style="color: blue"&gt;this&lt;/span&gt;.Width = &lt;span style="color: #2b91af"&gt;SystemParameters&lt;/span&gt;.FullPrimaryScreenWidth;
&lt;span style="color: blue"&gt;this&lt;/span&gt;.Height = &lt;span style="color: #2b91af"&gt;SystemParameters&lt;/span&gt;.FullPrimaryScreenHeight
          + &lt;span style="color: #2b91af"&gt;SystemParameters&lt;/span&gt;.CaptionHeight;
&lt;span style="color: blue"&gt;this&lt;/span&gt;.ResizeMode = &lt;span style="color: #2b91af"&gt;ResizeMode&lt;/span&gt;.NoResize; &lt;/pre&gt;

  &lt;p&gt;To most users (who are not looking to shake),&amp;#160; the window will still look like it is maximized. No difference. 
    &lt;br /&gt;To a user that is looking to shake, the window can be moved (and shaked).&amp;#160; The mere idea of ‘shaking’ a full screen window is not very common, but in this case the app was partially transparent so it did need it.&amp;#160; All I did was allow the shake again using DragMove, and then resetting the position of the window back to 0,0 after the shake.&amp;#160; &lt;br /&gt;

    &lt;br /&gt;&amp;#160;&lt;/p&gt;

  &lt;pre style="background-color: #e1f0f4" class="code"&gt;&lt;span style="color: blue"&gt;private void &lt;/span&gt;Window_MouseLeftButtonDown(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, MouseButtonEventArgs e)
        {
            &lt;span style="color: blue"&gt;this&lt;/span&gt;.DragMove();
            &lt;span style="color: blue"&gt;this&lt;/span&gt;.Left = 0;
            &lt;span style="color: blue"&gt;this&lt;/span&gt;.Top = 0; 

        }&lt;/pre&gt;

  &lt;p&gt;I am not claiming this is a best practice, but it worked good enough for my expectations.&amp;#160; If you want to see the code and decide if it works for your scenario, you can &lt;a href="http://www.cookingwithxaml.com/recipes/aero/AeroShakeonFullScreenWPF.zip" target="_blank"&gt;download a sample app from here.&lt;/a&gt; &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;Why the emphasis on WindowStyle=None, does Aero Shake work on WPF apps with standard windows?&amp;#160;&amp;#160; &lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Aero Shake works fine with standard WPF windows;&amp;#160; no changes are needed to your WPF apps.&amp;#160; It is the windowless apps that needed the few lines I have shared in these posts.&amp;#160; &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;At last, if you do not know what Aero Shake is, you can watch shake in action in this 15 seconds &lt;a href="http://www.istartedsomething.com/20081103/shake-up-your-windows-7-with-aero-shake/"&gt;video&lt;/a&gt;. &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9908941" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jaimer/archive/tags/Windows+Presentation+Foundation/default.aspx">Windows Presentation Foundation</category><category domain="http://blogs.msdn.com/jaimer/archive/tags/Windows+7/default.aspx">Windows 7</category></item><item><title>Implementing Aero Shake in a WindoStyle None WPF Window</title><link>http://blogs.msdn.com/jaimer/archive/2009/10/14/implementing-aero-shake-in-a-windostyle-none-wpf-window.aspx</link><pubDate>Thu, 15 Oct 2009 04:24:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9907434</guid><dc:creator>jaimer</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/jaimer/comments/9907434.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jaimer/commentrss.aspx?PostID=9907434</wfw:commentRss><description>&lt;p&gt;I just tried to implement Aero Shake in a WindowStyle=None WPF window.&lt;/p&gt;  &lt;p&gt;I had no clue what I would need to do; I figured I had to start by dragging the Window..&amp;nbsp;&amp;nbsp; tried that, ran it just to see what would happen and voila! Windows 7 did the rest…&amp;nbsp; &lt;/p&gt;  &lt;p&gt;I am going to the movies (since I had budgeted 3 hours for this)..&amp;nbsp;&amp;nbsp; Thanks Windows 7 Shell team!&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Window &lt;/span&gt;&lt;span style="color: red;"&gt;x&lt;/span&gt;&lt;span style="color: blue;"&gt;:&lt;/span&gt;&lt;span style="color: red;"&gt;Class&lt;/span&gt;&lt;span style="color: blue;"&gt;="WpfApplication40.Window1"&lt;br&gt;    &lt;/span&gt;&lt;span style="color: red;"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue;"&gt;="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;br&gt;    &lt;/span&gt;&lt;span style="color: red;"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue;"&gt;:&lt;/span&gt;&lt;span style="color: red;"&gt;x&lt;/span&gt;&lt;span style="color: blue;"&gt;="http://schemas.microsoft.com/winfx/2006/xaml"&lt;br&gt;    &lt;/span&gt;&lt;span style="color: red;"&gt;Title&lt;/span&gt;&lt;span style="color: blue;"&gt;="Window1" &lt;/span&gt;&lt;span style="color: red;"&gt;Height&lt;/span&gt;&lt;span style="color: blue;"&gt;="300" &lt;/span&gt;&lt;span style="color: red;"&gt;Width&lt;/span&gt;&lt;span style="color: blue;"&gt;="300" &lt;/span&gt;&lt;span style="color: red;"&gt;MouseLeftButtonDown&lt;/span&gt;&lt;span style="color: blue;"&gt;="Window_MouseLeftButtonDown" &lt;br&gt;        &lt;/span&gt;&lt;span style="color: red;"&gt;Opacity&lt;/span&gt;&lt;span style="color: blue;"&gt;="0.5" &lt;/span&gt;&lt;span style="color: red;"&gt;WindowStyle&lt;/span&gt;&lt;span style="color: blue;"&gt;="None" &lt;/span&gt;&lt;span style="color: red;"&gt;AllowsTransparency&lt;/span&gt;&lt;span style="color: blue;"&gt;="True"  &amp;gt;&lt;br&gt;    &lt;br&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Grid&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;br&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red;"&gt;Text&lt;/span&gt;&lt;span style="color: blue;"&gt;="Shake me.. please" &lt;/span&gt;&lt;span style="color: red;"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue;"&gt;="Center" &lt;br&gt;                   &lt;/span&gt;&lt;span style="color: red;"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="color: blue;"&gt;="Center" &lt;/span&gt;&lt;span style="color: red;"&gt;FontSize&lt;/span&gt;&lt;span style="color: blue;"&gt;="60"/&amp;gt; &lt;br&gt;     &amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Grid&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;br&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Window&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue;"&gt;private void &lt;/span&gt;Window_MouseLeftButtonDown(&lt;span style="color: blue;"&gt;object &lt;/span&gt;sender, &lt;span style="color: rgb(43, 145, 175);"&gt;MouseButtonEventArgs &lt;/span&gt;e)&lt;br&gt;       {&lt;br&gt;           &lt;span style="color: blue;"&gt;this&lt;/span&gt;.DragMove();            &lt;br&gt;       }&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9907434" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jaimer/archive/tags/Windows+Presentation+Foundation/default.aspx">Windows Presentation Foundation</category><category domain="http://blogs.msdn.com/jaimer/archive/tags/Windows+7/default.aspx">Windows 7</category></item><item><title>WPF Discussion 090922</title><link>http://blogs.msdn.com/jaimer/archive/2009/09/22/wpf-discussion-090922.aspx</link><pubDate>Tue, 22 Sep 2009 10:52:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9897892</guid><dc:creator>jaimer</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/jaimer/comments/9897892.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jaimer/commentrss.aspx?PostID=9897892</wfw:commentRss><description>&lt;p&gt;Raw, unedited, insightful and deep content from our internal WPF discussion… &lt;/p&gt;  &lt;hr /&gt;&lt;b&gt;Subject:&lt;/b&gt; Any chance of INotifyCollectionChanged moving to the core .NET libraries?   &lt;p&gt;The&amp;#160; System.Collections.Specialized.INotifyCollectionChanged interface is defined in WindowsBase.dll (primarily a WPF assembly) but my customer believes it should be pushed down into the core BCL so that other project types can benefit from it without requiring a reference to WPF/WindowsBase.&lt;/p&gt;  &lt;p&gt;Is this planned for 4.0 or later?&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#008000"&gt;Answer:        &lt;br /&gt;&lt;/font&gt;&lt;/strong&gt;&lt;font color="#008000"&gt;INotifyCollectionChanged, ObservableCollection&amp;lt;T&amp;gt;, and ReadOnlyObservableCollection&amp;lt;T&amp;gt; have been type forwarded into System.dll for .NET 4.&lt;/font&gt;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; Why TextRange.Load(MemoryStream, DataFormats.Xaml) can not work?&lt;/p&gt;  &lt;p&gt;I am trying to load a flowdocument from a Xaml file using TextRange.Load(MemoryStream, DataFormats.Xaml) method, but the following code does not work:&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; FlowDocument f = new FlowDocument();&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; TextRange range = new TextRange(f.ContentStart, f.ContentEnd);&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; StreamReader sr = new StreamReader(@&amp;quot;TextFile1.xaml&amp;quot;);&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; string aa = sr.ReadToEnd();&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; MemoryStream ms = new MemoryStream(System.Text.Encoding.Default.GetBytes(aa));&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; range.Load(ms, System.Windows.DataFormats.Xaml);&lt;/p&gt;  &lt;p&gt;I know if I use XamlReader.Load method will do the trick, but I don’t understand why the above code can’t work. Is this a bug or I am missing something?&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#008000"&gt;Answer: &lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;DataFormats.Xaml (and XamlPackage) are misleading – when consumed by TextRange.Load they only work on a subset of xaml generated by TextRange.Save.&amp;#160; The TextRange.Save/Load api is intended for editing scenarios where you need to persist arbitrary selections that may cross element boundaries (e.g., you need to save half of a Paragraph).&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;For your scenario, where you’re loading loose xaml from a file, XamlReader is the way to go.&lt;/font&gt;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; What is &amp;quot;Unlabeled time&amp;quot; in Visual Proiler that is part of Performance Profiling Tools for WPF?&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#008000"&gt;Answer: &lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;Any CPU time that we aren’t able to attribute to a specific WPF operation goes in the unlabeled bucket.&amp;#160; This includes time spent in CLR operations such as garbage collection and time spent in the application’s own code.&lt;/font&gt;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; Accessibility issue with WPF DataGrid and NewItemPlaceholder&lt;/p&gt;  &lt;p&gt;We’ve run into an accessibility issue with the WPF DataGrid concerning the NewItemPlaceholder.&amp;#160; Specifically, we’re re-templating the placeholder control in order to add a “real” click-here-to-add-a-new-item button.&amp;#160; However, none of the UI elements in the new template are available to accessibility-based automation (i.e. the button does not show up in UISpy or AccExplorer).&amp;#160; The template is set during the DataGrid LoadingRow event and looks like this:&lt;/p&gt;  &lt;p&gt;&amp;lt;ControlTemplate x:Key=&amp;quot;SafeControlNewRowControlTemplate&amp;quot; TargetType=&amp;quot;{x:Type DataGridRow}&amp;quot;&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;SelectiveScrollingGrid&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;Button Content=&amp;quot;Click here to add a new item.&amp;quot; Margin=&amp;quot;5,5,0,0&amp;quot; x:Uid=&amp;quot;AssemblyDialogWindow_SafeControlAddNewItem&amp;quot; Click=&amp;quot;OnSafeControlNewRowButtonClicked&amp;quot;/&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;/SelectiveScrollingGrid&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;/ControlTemplate&amp;gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#008000"&gt;Answer: &lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;Yeah the AutomationPeers for all of the DataGrid components are structured around rows and cells. In your scenario you are retemplating a row (NewItemPlaceHolder row) so it does not have cells. Unfortunately the AutomationPeers do not recognize this. So you will in fact need to jump through some hoops to enable this scenario.&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font color="#008000"&gt;Subclass DataGridRowAutomationPeer and override GetChildrenCore to special case NewItemPlaceHolder row and return the visual children instead of the cells.&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font color="#008000"&gt;Subclass DataGridRow and override OnCreateAutomationPeer to return the subclassed DataGridRowAutomationPeer.&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font color="#008000"&gt;Subclass DataGrid and override GetContainerForItemOverride to return the subclassed DataGridRow.&lt;/font&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; Adding ContextMenu to DataGrid header&lt;/p&gt;  &lt;p&gt;I am using WPF 4.0 DataGrid and want to add context menu only to the header. The way that I found to do is to add a ContextMenu setter property to a style and assign the style to the DataGrid.ColumnHeaderStyle.&lt;/p&gt;  &lt;p&gt;&lt;i&gt;&lt;font color="#008000"&gt;Answer: This is the right way of setting the context menu on DataGridColumnHeader (either using an implicit style for DataGridColumnHeader or setting it explicitly using ColumnHeaderStyle property).&lt;/font&gt;&lt;/i&gt;&lt;/p&gt;  &lt;p&gt;But this puts restriction that a style needs to be added to the ColumnHeader. Performing SetValue on “DataGridColumnHeader.ContextMenuProperty” somehow sets it for the entire grid. The context menu should only be for the header.&lt;/p&gt;  &lt;p&gt;&lt;i&gt;&lt;font color="#008000"&gt;Answer:&amp;#160; This won’t work. When one uses ‘DataGridColumnHeader.ContextMenu’ property, note that one is using the property which internally happens to be the same for DataGrid too (because ContextMenu is defined on FrameworkElement and all controls share the same property definition). Hence that would end up setting the value of DataGrid itself.&lt;/font&gt;&lt;/i&gt;&lt;/p&gt;  &lt;p&gt;Is there any way to add context menu only to the header w/o having to set ColumnHeaderStyle?&lt;/p&gt;  &lt;p&gt;&lt;i&gt;&lt;font color="#008000"&gt;Answer:&amp;#160; Use implicit style for DataGridColumnHeader. But honestly I don’t see any difference from using ColumnHeaderStyle.&lt;/font&gt;&lt;/i&gt;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; Adding HierarchicalDataTemplate via UI?&lt;/p&gt;  &lt;p&gt;How can I add a HierarchicalDataTemplate for Silverlight 3 via the Blend 3 UI (without typing in the class in XAML)?&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#008000"&gt;Answer:&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;Steps:      &lt;br /&gt;&lt;/font&gt;&lt;font color="#008000"&gt;1. Create a new sample data      &lt;br /&gt;2. Click on the triangle of&amp;#160; “add simple property”, select “convert to Hierarchical Collection”       &lt;br /&gt;3. Drag the converted Hierarchical Collection to artboard       &lt;br /&gt;&lt;/font&gt;&lt;font color="#008000"&gt;View the xaml, notice the Blend generated HierarchicalDataTemplate is bound to the generated tree view.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;Here is a more complete TreeView editing experience write-up:      &lt;br /&gt;&lt;/font&gt;&lt;a href="http://shawnoster.com/Blog/Silverlight-TreeView-Connecting-Lines-And-Blend-3-Support-for-HierarchicalDataTemplates"&gt;&lt;font color="#008000"&gt;http://shawnoster.com/Blog/Silverlight-TreeView-Connecting-Lines-And-Blend-3-Support-for-HierarchicalDataTemplates&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; debugging an unmanaged exception in WPF app. &lt;/p&gt;  &lt;p&gt;tried to debug my application I saw the following message &lt;i&gt;“The debugger does not support debugging managed and native code at the same time on this platform.”&lt;/i&gt;&lt;/p&gt;  &lt;p&gt;How could I enable only native code debugger without managed one?&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&lt;strong&gt;Answer:        &lt;br /&gt;&lt;/strong&gt;There may be other ways, but this should work.       &lt;br /&gt;Right-Click on the solution, select&amp;#160; “Add Existing Project” and select the compiled exe.       &lt;br /&gt;Set the exe project as the startup project.       &lt;br /&gt;Right-Click, go to Properties and set “Debugger Type” to “Native Only”&lt;/font&gt;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; API that can determine whether a keystroke yields printable characters or not     &lt;br /&gt;I have a KeyDown event and System.Windows.Input.KeyEventArgs event arg e.     &lt;br /&gt;Is there any API that I can use to determine whether this e.Key is printable or not? Or is there any API I can get the character of this keystroke?&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&lt;strong&gt;Answer:        &lt;br /&gt;&lt;/strong&gt;Generally, no. KeyDown to text conversion is pretty stateful, and you don’t have access to this state. Most of it is maintained by the OS.&lt;/font&gt;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; XBAP and multi touch in Windows7&lt;/p&gt;  &lt;p&gt;Will all multi touch features in WPF 4 be available when running on Windows 7 as XBAPs as well?&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&lt;strong&gt;Answer:        &lt;br /&gt;&lt;/strong&gt;Yes, manipulation and touch events are available in PT. However you cannot implement your own touch device.&lt;/font&gt;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; X:Name and Name property&lt;/p&gt;  &lt;p&gt;I have a quick question on why do we have Name for some of the Classes and have to use x:Name for the classes related to Animation/Timelines. Why is this difference in the framework and no uniformity?&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#008000"&gt;Answer:&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;XAML uses [RuntimeNameProperty(“somePropName”)] on classes to signify when a property is the “Name” property (and thus aliased with x:Name).      &lt;br /&gt;XAML treats the two interchangeably when a type does have a RutimeName declared.       &lt;br /&gt;If a tag has both, that is an error.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;Reasons for where we ended up:      &lt;br /&gt;· We wanted WPF to not have to require 2 namespaces to have a Named object.       &lt;br /&gt;· We didn’t want to hard code all “Name” properties as the Name.&lt;/font&gt;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; WPF colour depth rendering support&lt;/p&gt;  &lt;p&gt;Hi all,&lt;/p&gt;  &lt;p&gt;I'm working on an application that displays DICOM images, the spec allows for images to have greater than 8 bits per channel which most if not all of my test data does have and is very common in medical images. I read on &lt;a href="http://blogs.msdn.com/dwayneneed/archive/2008/06/20/implementing-a-custom-bitmapsource.aspx"&gt;http://blogs.msdn.com/dwayneneed/archive/2008/06/20/implementing-a-custom-bitmapsource.aspx&lt;/a&gt; that &amp;quot;The WPF rasterizer only natively renders bitmaps in Bgr32 and PBgra32 formats&amp;quot; (In the 'WIC in WPF' section, 5th paragraph), is there any way to have a WPF application render an image in PixelFormats.Prgba64 or PixelFormats.Gray16 (or an equivalent)?&lt;/p&gt;  &lt;p&gt;Thanks,&lt;/p&gt; &lt;strong&gt;&lt;font color="#008000"&gt;Answer: &lt;/font&gt;&lt;/strong&gt;  &lt;p&gt;&lt;font color="#008000"&gt;No. As Dwayne’s blog notes, the WPF rendering pipeline operates in 32-bit only, so all images are format converted to that before being processed.&lt;/font&gt;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; Workaround for IsDeferredScrollingEnabled bug&lt;/p&gt;  &lt;p&gt;When using a ComboBox inside of a ScrollViewer with IsDeferredScrollingEnabled=true scrolling in the ComboBox does not work correctly.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#008000"&gt;Answer: &lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;You’ve certainly hit a bug and we are recording one for this scenario. As for a workaround, you can set IsDeferredScrollingEnabled to true for the ComboBox as well to get all the scrollviewers to work correctly. Like this.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&amp;lt;StackPanel.Resources&amp;gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&amp;lt;Style TargetType=&amp;quot;ComboBox&amp;quot;&amp;gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&amp;#160; &amp;lt;Setter Property=&amp;quot;ScrollViewer.IsDeferredScrollingEnabled&amp;quot; Value=&amp;quot;true&amp;quot; /&amp;gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&amp;lt;/Style&amp;gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&amp;lt;/StackPanel.Resources&amp;gt;&lt;/font&gt;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; WindowStyle.None + ResizeMode.CanResize vs. NoResize&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/jaimer/WindowsLiveWriter/WPFDiscussion_3FE/clip_image002_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image002" border="0" hspace="12" alt="clip_image002" src="http://blogs.msdn.com/blogfiles/jaimer/WindowsLiveWriter/WPFDiscussion_3FE/clip_image002_thumb.jpg" width="70" height="244" /&gt;&lt;/a&gt;I’m trying to recreate a window like the volume window, where there’s minimal chrome and cannot be resized.&lt;/p&gt;  &lt;p&gt;WindowStyle.None renders a window without a title bar. ResizeMode.NoResize will make a window not resize (surprise, surprise). Unfortunately, when you use them both together, there is no window chrome at all. I’ve tried setting the min/max height/width, which works, but I still get the resize mouse icon when I hover over the window border. Is it possible to render a minimal chrome without the resize icon?&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#008000"&gt;Answer: &lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;I think you should be able to use what you have and p/invoke to set the Window's native style to include WS_BORDER.      &lt;br /&gt;There isn't a combination in WPF's Window that supports what you're trying to express.&lt;/font&gt;     &lt;br /&gt;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; Window chrome size&lt;/p&gt;  &lt;p&gt;Is there a way to get the height of the title bar and width of little border on the left in a window. I’m trying to create an overlay window via databinding (would use popup, but it doesn’t seem to respect bindings like Window does) so I need to add in the chrome size to find the global position of the window’s client area. Or maybe there is an easier way? &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#008000"&gt;Answer: &lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;You might try Visual.PointToScreen to see if it does what you want.&amp;#160; I think it gives coordinates in actual device pixels, so if you need to position your overlay using WPF's 1/96&amp;quot; units, you'll have to multiply by 96/systemDPI.&amp;#160; With some effort, you can get this scale factor from HwndTarget.TransformFromDevice.&lt;/font&gt;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; RE: Viewing WPF applications over Citrix&lt;/p&gt;  &lt;p&gt;What would be the implications of running WPF over Citrix. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#008000"&gt;Answer: &lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;All versions of WPF since WPF 3.5 SP1 have remoted (both with Remote Desktop and Terminal Server) using Bitmap Remoting.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;Bitmap remoting works as follows:&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font color="#008000"&gt;The application is rendered on the server using WPF’s software rasterizer&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font color="#008000"&gt;As the application runs, the server keeps track of which regions of the application’s window are newly dirty and need to be updated&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font color="#008000"&gt;When a region needs to be updated, the server creates a compressed bitmap of just the dirty region and sends that to the client&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font color="#008000"&gt;Once the client has drawn that bitmap to the appropriate place on its own window, the client window is up-to-date&lt;/font&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;font color="#008000"&gt;Given how this remoting mechanism works, performance can be maximized in several ways:&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font color="#008000"&gt;Dirty regions should be kept as small as possible so the least amount of data is sent over the wire&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font color="#008000"&gt;Ambient animations should be turned off.&lt;/font&gt;       &lt;ul&gt;       &lt;li&gt;&lt;font color="#008000"&gt;For instance, setting a window background to an animating gradient would cause the entire window to be invalidated / redrawn every frame&lt;/font&gt; &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;font color="#008000"&gt;The system does not optimize away occluded parts of the application&lt;/font&gt;       &lt;ul&gt;       &lt;li&gt;&lt;font color="#008000"&gt;For instance, an animation that is completely hidden behind some other opaque element will &lt;i&gt;still&lt;/i&gt; cause dirty region invalidation / bitmap generation to occur.&amp;#160; Remove these from your application.&lt;/font&gt; &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;font color="#008000"&gt;Dirty regions should be created as infrequently as possible&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font color="#008000"&gt;Turn off as many animations as possible&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font color="#008000"&gt;For those animations that can’t be eliminated completely, lower the animation framerate using the DesiredFramerate property&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font color="#008000"&gt;Dirty Region Bitmaps should be as simple as possible to maximize their compression&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font color="#008000"&gt;Application running over TS should favor solid colors over gradients or other exotic fills (unnecessary images, etc), especially for application pieces that will be redrawn frequently&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font color="#008000"&gt;Avoid operations that are especially slow when rendered in software&lt;/font&gt;       &lt;ul&gt;       &lt;li&gt;&lt;font color="#008000"&gt;BitmapEffects / Effects / ShaderEffects, especially blurs and drop shadows with large radii, are quite slow in software&lt;/font&gt; &lt;/li&gt;        &lt;li&gt;&lt;font color="#008000"&gt;3D – the 3D software rasterizer is substantially slower than rendering in hardware&lt;/font&gt; &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; Spell checker does not pick up the current input language if it changes&lt;/p&gt;  &lt;p&gt;If I create an empty application, with:    &lt;br /&gt;&amp;lt;TextBox SpellCheck.IsEnabled=&amp;quot;True&amp;quot; /&amp;gt;     &lt;br /&gt;And I enter text in English, all is good. If I delete all my text in that textbox, change my input language to German (for example), and input German words, it will still be spell checking in English. If I restart the app with my input language set to German, it will spell check correctly.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#008000"&gt;Answer: &lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;It’s by design.&amp;#160; TextBox doesn’t track input language (unlike RichTextBox, which will tag every character entered with the current input language).&amp;#160; TextBox can’t track the input language of individual characters because it contains nothing but Unicode.&amp;#160; So,&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;1. If TextBox.Language is set, the speller will respect it.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;2. If TextBox.Language is unset/default (en-us), the speller uses a heuristic, reading the input language set when spelling is enabled.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;Language is an inheritable property, so setting it on any parent element will affect a TextBox.&amp;#160; The speller will honor any Language value that is not default -- local, inherited, or styled.&lt;/font&gt;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; turn off bitmap effects?     &lt;br /&gt;Is there a registry setting to turn off bitmap effects?&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#008000"&gt;Answer:&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;No there isn’t. But in 4.0 all the *BitmapEffect classes are either no-opd or redirected to their *Effect equivalents (for the case of DropShadow and Blur).&lt;/font&gt; &lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; RadioButton/ToggleButtons with DataBinding&lt;/p&gt;  &lt;p&gt;Does anyone have an example of a group of RadioButtons or ToggleButtons working with DataBinding?    &lt;br /&gt;We've found it quite difficult to get this working in a straightforward way.&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&lt;strong&gt;Answer:        &lt;br /&gt;&lt;/strong&gt;Ralph, yes there are known issues about RadioButtons and other Controls setting local values upon user interaction and hence clobbering app set Bindings in .Net 3.5&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;I've worked around this issue in .NET 3.5 SP1.&amp;#160; Here's how I data bind a group of radio buttons to an enum-valued property:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&amp;lt;StackPanel&amp;gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&amp;lt;RadioButton Content=&amp;quot;New folder&amp;quot;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; IsChecked=&amp;quot;{Binding Path=PublishTarget,&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Converter={StaticResource equalityConverter},&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ConverterParameter={x:Static local:PublishTarget.NewServerFolder},&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;Mode=TwoWay}&amp;quot;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;GroupName=&amp;quot;1&amp;quot;/&amp;gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&amp;#160; &amp;lt;RadioButton Content=&amp;quot;Existing folder&amp;quot;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; IsChecked=&amp;quot;{Binding Path=PublishTarget,&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;Converter={StaticResource equalityConverter},&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;ConverterParameter={x:Static local:PublishTarget.ExistingServerFolder},&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;Mode=TwoWay}&amp;quot;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; GroupName=&amp;quot;2&amp;quot;/&amp;gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&amp;#160; &amp;lt;RadioButton Content=&amp;quot;Local folder&amp;quot;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;IsChecked=&amp;quot;{Binding Path=PublishTarget,&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;Converter={StaticResource equalityConverter},&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ConverterParameter={x:Static local:PublishTarget.LocalFolder},&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Mode=TwoWay}&amp;quot;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; GroupName=&amp;quot;3&amp;quot;/&amp;gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&amp;lt;/StackPanel&amp;gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;Setting each radio button's GroupName to a unique value prevents the bindings from getting clobbered when the user clicks on a radio button.&amp;#160; Here I'm relying on the data source to implement INotifyPropertyChanged, which will tell the other radio buttons to update.&amp;#160; A similar approach should work for radio buttons in an ItemsControl.&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9897892" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jaimer/archive/tags/Windows+Presentation+Foundation/default.aspx">Windows Presentation Foundation</category><category domain="http://blogs.msdn.com/jaimer/archive/tags/wpfdiscussion/default.aspx">wpfdiscussion</category></item><item><title>Expression Studio TuTorialS Starter Kit</title><link>http://blogs.msdn.com/jaimer/archive/2009/08/11/expression-studio-tutorials-starter-kit.aspx</link><pubDate>Wed, 12 Aug 2009 09:26:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9865624</guid><dc:creator>jaimer</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/jaimer/comments/9865624.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jaimer/commentrss.aspx?PostID=9865624</wfw:commentRss><description>&lt;p&gt;Via &lt;a href="http://ux.artu.tv/"&gt;Arturo Toledo&lt;/a&gt; (internal email).&amp;#160; The Expression team released four great Expression starter kits today.. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://download.microsoft.com/download/A/4/9/A49AB02F-F035-402C-9B26-84860EEAF7DC/Prototyping_with_Sketchflow_StarterKit.zip"&gt;Introduction to Prototyping with Sketchflow in Expression Blend 3&lt;/a&gt;    &lt;br /&gt;Discover Sketchflow, a new feature set in Expression Blend 3 that helps you define the concept for user experiences in early stages of the design process. From sketches to wireframes to protoypes of simple or high definition, Sketchflow provides you the right tools to communicate your ideas and gather feedback from others.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://download.microsoft.com/download/1/1/C/11C8F2E2-711B-4581-A688-6B66DA4D1124/VentureIntoGaming_ExpressionBlend3_StarterKit.zip"&gt;Venture into Gaming with Behaviors in Expression Blend 3&lt;/a&gt;&amp;#160; &lt;br /&gt;Learn more about how to build a traditional &amp;quot;bricks&amp;quot; game using Expression Blend 3 Behaviors. Simply drag and drop Behaviors over objects in your artboard to easily add powerful and sophisticated functions like animation, physics, interactivity, data connection, effects and more. All without coding. The ever growing Behaviors Gallery at expression.microsoft.com is always available for you to download new behaviors.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://download.microsoft.com/download/F/3/4/F343C86B-FEE4-4448-8715-CA768BB305FE/ExpressionWeb3_SuperPreview_StarterKit.zip"&gt;Discovering SuperPreview in Expression Web 3&lt;/a&gt;&lt;strong&gt;      &lt;br /&gt;&lt;/strong&gt;Learn more about SuperPreview, a new visual diagnostics tool in Expression Web 3. In this Starter Kit you will be provided with detailed guidance on how to leverage SuperPreview to diagnose issues across multiple browser, all with full rendering fidelity and detailed control.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://download.microsoft.com/download/B/9/8/B9874A4F-58F8-4D01-8E2F-E1DAC62ED4A3/SilverlightSupport_Web3_StarterKit.zip"&gt;Support for Silverlight in Expression Web 3&lt;/a&gt;    &lt;br /&gt;Learn how to leverage the new and easy to use Silverlight support features in Expression Web 3. Then take your websites and publish them to an FTP location without having to leave Expression Web. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;------- &lt;/p&gt;  &lt;p&gt;I just got done watching the Sketchflow tutorial videos; they were excellent!!&amp;#160; Moving to behaviors next :) &lt;/p&gt;  &lt;p&gt;Enjoy!! &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9865624" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jaimer/archive/tags/Windows+Presentation+Foundation/default.aspx">Windows Presentation Foundation</category><category domain="http://blogs.msdn.com/jaimer/archive/tags/expression/default.aspx">expression</category><category domain="http://blogs.msdn.com/jaimer/archive/tags/silverlight/default.aspx">silverlight</category></item><item><title>WPF discussions 08082009</title><link>http://blogs.msdn.com/jaimer/archive/2009/08/09/wpf-discussions-08082009.aspx</link><pubDate>Mon, 10 Aug 2009 06:09:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9862566</guid><dc:creator>jaimer</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/jaimer/comments/9862566.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jaimer/commentrss.aspx?PostID=9862566</wfw:commentRss><description>&lt;p&gt;Raw/unedited useful WPF advise.. &lt;/p&gt;  &lt;hr /&gt;&lt;strong&gt;Subject: &lt;/strong&gt;Control Verifier   &lt;br /&gt;&lt;strong&gt;From: &lt;/strong&gt;Samantha Durante, our controls PM   &lt;p&gt;&lt;font color="#008000"&gt;&lt;strong&gt;Answer:       &lt;br /&gt;&lt;/strong&gt;&lt;/font&gt;&lt;font color="#008000"&gt;I just wanted to let you know that we’ve just released &lt;strong&gt;Version 0.1 of the&lt;/strong&gt; &lt;a href="http://wpf.codeplex.com/Wiki/View.aspx?title=WPF%20Control%20Verifier"&gt;WPF Control Verifier&lt;/a&gt; tool.&amp;#160; &lt;br /&gt;&lt;/font&gt;&lt;font color="#008000"&gt;WPF Control Verifier is a tool that verifies the correctness of WPF Controls. This tool is geared towards WPF Control developers with the goal of providing a set of verifications that all controls can run and consume. Version 0.1 includes one category for verification – default style verification. These tests verify that your control can be styled such that its dependency properties are inheriting or template binding correctly. Future versions will include additional categories of verification.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;You can download this tool in the &lt;strong&gt;new&lt;/strong&gt; &lt;a href="http://wpf.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=30923"&gt;WPF Test Tools&lt;/a&gt;&lt;strong&gt; release&lt;/strong&gt; at the &lt;/font&gt;&lt;a href="http://wpf.codeplex.com/Wiki/View.aspx?title=Home"&gt;&lt;font color="#008000"&gt;WPF Codeplex&lt;/font&gt;&lt;/a&gt;&lt;font color="#008000"&gt; site.&amp;#160;&amp;#160; &lt;/font&gt;&lt;/p&gt;  &lt;hr /&gt;&lt;b&gt;Subject:&lt;/b&gt; Application checking .NET 3.0 is installed   &lt;br /&gt;What's the best way to determine if the user's computer has .NET 3.0 installed?   &lt;p&gt;&lt;font color="#008000"&gt;&lt;strong&gt;Answer:        &lt;br /&gt;&lt;/strong&gt;Check the Registry.       &lt;br /&gt;The official guide: &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/aa480198.aspx#netfx30_topic14"&gt;&lt;font color="#008000"&gt;http://msdn.microsoft.com/en-us/library/aa480198.aspx#netfx30_topic14&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;  &lt;hr /&gt;&lt;b&gt;Subject:&lt;/b&gt; RE: Binding doesn't seem to work: System.Windows.Data Error: 4   &lt;br /&gt;Long discussion on how RelativeSource (binding to Ancestor) is indeterminate with regards to when parent is added to the tree;   &lt;p&gt;&lt;strong&gt;&lt;font color="#008000"&gt;Answer:        &lt;br /&gt;&lt;/font&gt;&lt;/strong&gt;&lt;font color="#008000"&gt;In general, RelativeSource looking for an Ancestor type isn't robust against delayed addition to the tree, and not at all against reparenting.&amp;#160; I only learned this earlier this week, debugging a similar issue.&amp;#160; Consider instead making &amp;quot;MyProperty&amp;quot; an inheritable property, and just binding to Self, MyProperty.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;(Jaime’s personal take added now).&amp;#160; I do use RelativeSource within generated items in ItemsControls. Seems usable there and seems like a good place to apply it; if the scenario was different (less items in particular and shallow trees) then inherited property sounds good too. &lt;/font&gt;&lt;/p&gt;  &lt;hr /&gt;   &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; Knowing if a control is partly occluded&lt;/p&gt;  &lt;p&gt;I’m working on adding tooltips to controls that are partly occluded on mouse hover (like the Outlook folders pane does). What’s the right way to know whether something has been partly occluded?&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&lt;strong&gt;Answer:&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;///&amp;lt;summary&amp;gt;      &lt;br /&gt;/// This eliminates the part of bounding rectangle if it is at all being overlapped/clipped by any of the visual ancestor up in the parent chain       &lt;br /&gt;///&amp;lt;/summary&amp;gt;       &lt;br /&gt;internal Rect CalculateVisibleBoundingRect()       &lt;br /&gt;{ &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&amp;#160;&amp;#160;&amp;#160; Rect boundingRect = Rect.Empty; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&amp;#160;&amp;#160;&amp;#160; boundingRect = new Rect(_owner.RenderSize);      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; // Compute visible portion of the rectangle. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&amp;#160;&amp;#160;&amp;#160; Visual visual = VisualTreeHelper.GetParent(_owner) as Visual;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; while (visual != null &amp;amp;&amp;amp; boundingRect != Rect.Empty &amp;amp;&amp;amp; boundingRect.Height != 0 &amp;amp;&amp;amp; boundingRect.Width != 0)       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Geometry clipGeometry = VisualTreeHelper.GetClip(visual);       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; if (clipGeometry != null)       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; GeneralTransform transform = _owner.TransformToAncestor(visual).Inverse;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // Safer version of transform to descendent (doing the inverse ourself and saves us changing the co-ordinate space of the owner's bounding rectangle),       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // we want the rect inside of our space. (Which is always rectangular and much nicer to work with)       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; if (transform != null)       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Rect clipBounds = clipGeometry.Bounds;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; clipBounds = transform.TransformBounds(clipBounds);       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; boundingRect.Intersect(clipBounds);       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; else       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // No visibility if non-invertable transform exists.       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; boundingRect = Rect.Empty;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; visual = VisualTreeHelper.GetParent(visual) as Visual;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; } &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&amp;#160;&amp;#160;&amp;#160; return boundingRect;      &lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;   &lt;hr /&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; RE: BitmapImage.StreamSource - best practice for closing the stream?     &lt;br /&gt;If I use BitmapImage, then set in the StreamSource, no one seems to ever close the stream.&amp;#160; The net effect is this locks the file in memory – preventing file renames, etc.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#008000"&gt;Answer:        &lt;br /&gt;&lt;/font&gt;&lt;/strong&gt;&lt;font color="#008000"&gt;By default images are delay decoded. Set the CacheOption to BitmapCacheOption.OnLoad to force eager decode of the stream.&lt;/font&gt;&amp;#160; &lt;/p&gt;  &lt;hr /&gt;&lt;b&gt;Subject:&lt;/b&gt; CollectionView, Sort Descriptions, Turkish I, and Custom Sorts  &lt;p&gt;Given a CollectionView, and some SortDescriptions, how does one ensure that the sorting is correct for the current culture? Should I use Custom sort? &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#008000"&gt;Answer:        &lt;br /&gt;&lt;/font&gt;&lt;/strong&gt;&lt;font color="#008000"&gt;ListCollectionView’s sorting uses the Culture property.&amp;#160;&amp;#160; If you don’t set this, it’s set to agree with the Language of the client element.&amp;#160; For example,&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;ListBox&amp;#160; ItemsSource=”…” Language=”tr-TR”/&amp;gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;will sort in Turkish.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;The CustomSort lets you define your own comparison logic.&amp;#160; You can pay attention to whichever columns you like, and choose case-sensitive or insensitive.&lt;/font&gt;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; DecodePixelWidth     &lt;br /&gt;I’d like to investigate DecodePixelWidth to reduce memory consumption when viewing large images on the design surface.&amp;#160; &lt;br /&gt;Is there a way without loading the image itself to grab the metadata that would tell me what the size of the image is?&lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;&lt;font color="#008000"&gt;&lt;strong&gt;Answer:&lt;/strong&gt;       &lt;br /&gt;Unfortunately no.&lt;/font&gt;    &lt;hr /&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; Getting HyperLink content    &lt;br /&gt;I'm trying to get the text of a hyperlink via code, and I can't find it.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#008000"&gt;Answer:       &lt;br /&gt;&lt;/font&gt;&lt;/strong&gt;&lt;font color="#008000"&gt;TextRange range = new TextRange(link.ContentStart, link.ContentEnd);      &lt;br /&gt;&lt;/font&gt;&lt;font color="#008000"&gt;string text = range.Text;&lt;/font&gt;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; Implement Attribute x:Uid    &lt;br /&gt;Is it possible to implement the localization attribute x:Uid? We would like to implement this attribute without inheriting from UIElement and make it possible to use XAMLReader/XAMLWriter API.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#008000"&gt;Answer:       &lt;br /&gt;&lt;/font&gt;&lt;/strong&gt;&lt;font color="#008000"&gt;If you’re working with 4.0, you can set the UidPropertyAttribute on your type and it’ll set whatever property you need it on.     &lt;br /&gt;&lt;/font&gt;&lt;font color="#008000"&gt;There is no way in 3.X.&amp;#160; Uid was hard coded in the system to only work with UIElements. Uid is ignored on all other types at runtime.&lt;/font&gt;     &lt;hr /&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; Invisible Hyperlink can still receive focus&lt;/p&gt;  &lt;p&gt;For following xaml, the hyperlink hyper1 is invisible, but can still receive keyboard focus, I need to set it’s Focusable to false to stop it receiving focus, is this the expected behavior?    &lt;br /&gt;&amp;lt;TextBlock Visibility=&amp;quot;Collapsed&amp;quot;&amp;gt;&amp;lt;Hyperlink x:Name=&amp;quot;hyper1&amp;quot;/&amp;gt;&amp;lt;/TextBlock&amp;gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&lt;strong&gt;Answer:&lt;/strong&gt;       &lt;br /&gt;This appears to be a bug in TextBlock and is not specific to Hyperlink.&amp;#160; If you replace the Hyperlink with a Button, it loses Tab navigation completely while other panels work as expected.&lt;/font&gt;&amp;#160; &lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; Mouse wheel in winform interop scenario&lt;/p&gt;  &lt;p&gt;Hi,&lt;/p&gt;  &lt;p&gt;Our project embed a Dunas chart control inside a WindowsFormHost. We want to support mouse wheel on it for zooming. The dunas document specifically call out that mouse wheel does not work unless the control is focused (indeed, when there is no focus, the chart does not receive mouse wheel message, and I guess this is not specific to dunas control but to general winform control too). The&amp;#160; initial thought is to programmatically set focus on the dunas control. However, this is apparently bad that if other elements get focus this stops working. &lt;/p&gt;  &lt;p&gt;Now my goal is to enable mouse wheel without messing with focus. If I am able to intercept mouse wheel message (no matter focused or not) I can work with the control to simulate zooming. The first attempt was to derive from WindowsFormHost and override WndProc to see if I can receive mouse wheel message there without being focused. It did not working (not surprising).&lt;/p&gt;  &lt;p&gt;After looking into MSDN I found ComponentDispatcher class. So I tried the following code:&lt;/p&gt;  &lt;p&gt;ComponentDispatcher.ThreadFilterMessage += delegate(ref MSG msg, ref bool handled)&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;  &lt;p&gt;if (msg.message == 0x20A) /*MouseWheel*/&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; System.Diagnostics.Trace.WriteLine(&amp;quot;Receiving mouse wheel message&amp;quot;);&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; System.Diagnostics.Trace.WriteLine(&amp;quot;msg window &amp;quot; + msg.hwnd);&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; System.Diagnostics.Trace.WriteLine(&amp;quot;WindowsFormsHost handle : &amp;quot; + this.wfhost.Handle);&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; };&lt;/p&gt;  &lt;p&gt;Well now I do get mouse wheel message. But I get ALL of them even if the mouse is not on the control. The windows handle in the message is not the same as reported by WindowsFormHost, it is actually the main window (which is logical since this essentially comes from main message pump). &lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&lt;strong&gt;Answer:        &lt;br /&gt;&lt;/strong&gt;&lt;/font&gt;&lt;font color="#008000"&gt;Windows will deliver the WM_MOUSEWHEEL to the HWND with focus.&amp;#160; So you will have to start from there.&amp;#160; You can either subclass that window proc, or you can use the ComponentDispatcher to watch the messages come through the message pump.&amp;#160; The HWND in the message will be whatever HWND has focus – such as the main App window.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;You can then look at chart.IsMouseOver to decide whether or not to respond to the message.&lt;/font&gt;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; Override tab ordering of panel&lt;/p&gt;  &lt;p&gt;We implemented our custom Panel class and want to change the tab navigation behavior.    &lt;br /&gt;Does anyone know where to override the default behavior?&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&lt;strong&gt;Answer:&lt;/strong&gt;       &lt;br /&gt;You can set KeyboardNavigation.TabNavigation property on the custom Panel to the mode you like.       &lt;br /&gt;Then TabIndex property on subelements if you want to change the Tab traverse order.&lt;/font&gt;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; Question with ReadOnly RichTextBox&lt;/p&gt;  &lt;p&gt;I have a window that contains a RichTextBox control used to display read-only text. As such, I have set the IsReadOnly property to ‘True’ so that the text inside the RichTextBox is not editable. However, setting this property also disables many keyboard navigation commands, such as arrow up/down, page up/down. Some commands, such as text selection (Ctrl+A, Shift+Up/Down/Left/Right) still work. Does the RichTextBox require any additional configuration for the keyboard navigation commands to work when IsReadOnly is set to True?    &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&lt;strong&gt;Answer:&lt;/strong&gt; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;In &amp;lt;=3.5sp1, keyboard navigation is not fully supported when IsReadOnly is set to true. In 4.0, we’ve added a new property to TextBoxBase (IsReadOnlyCaretVisible) which enables both the caret rendering and keyboard navigation in read only mode.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;   &lt;hr /&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; Is it possible to utilize the functionality of DocumentViewer's FindToolBar programatically?    &lt;br /&gt;&lt;font color="#008000"&gt;&lt;strong&gt;Answer:&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;Unfortunately the search API used by the document viewers is not publicly exposed and as far as I know there are no plans to expose it in the near future.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;-----------------&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; SplashScreen Bug&lt;/p&gt;  &lt;p&gt;Hello Folks,&lt;/p&gt;  &lt;p&gt;Our client has a bug with the use of the SplashScreen class present in the Framework 3.5 Sp1. The bug are the same that the one describe in these differents threads:&lt;/p&gt;  &lt;p&gt;· &lt;a href="http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=378575"&gt;http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=378575&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;· &lt;a href="http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=362735"&gt;http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=362735&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;It seems that this bug is corrected en the next release of WPF (4.0) But our client needs to release our application &lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&lt;strong&gt;Answer:&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;You can work around both of those issues using the existing SplashScreen by not using the fade out.&lt;/font&gt;&lt;font color="#008000"&gt;To do that you’ll need to write a main method that looks something like this:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;[STAThread]&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;public static void Main(string[] args)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;{&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;SplashScreen sp = new SplashScreen(&amp;quot;splash.png&amp;quot;);&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&amp;#160;&amp;#160;&amp;#160; sp.Show(false);&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;Dispatcher.CurrentDispatcher.BeginInvoke((Action)(() =&amp;gt; sp.Close(TimeSpan.Zero)), DispatcherPriority.Loaded);&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&amp;#160;&amp;#160;&amp;#160; WpfApplication1.App app = new WpfApplication1.App();&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&amp;#160;&amp;#160;&amp;#160; app.InitializeComponent();&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&amp;#160;&amp;#160;&amp;#160; app.Run();&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; Question about ListView sorting feature&lt;/p&gt;  &lt;p&gt;When I am developing sorting feature for the ListView, I observed a interesting behavior. Could someone help to identify whether it is by design? I also attached the project. &lt;/p&gt;  &lt;p&gt;Say I have a listview, and the values in column “Test Enabled” are all the same. When I click the column header, the column will be sorted. &lt;/p&gt;  &lt;p&gt;Step 1, see picture 1, no column is sorted.    &lt;br /&gt;Step 2, click column header of column “Test Enabled”, column “Machine” is sorted. (Could anyone tell me why?).     &lt;br /&gt;Step 3, click column header of column “Test Enabled”, no changes.     &lt;br /&gt;Step 4, click column header of column “Test Enabled”, no changes.&lt;/p&gt;  &lt;p&gt;The way I implement the sorting is very simple:&lt;/p&gt;  &lt;p&gt;//sort the machines.&lt;/p&gt;  &lt;p&gt;ICollectionView view = CollectionViewSource.GetDefaultView(this.Machines);&lt;/p&gt;  &lt;p&gt;view.SortDescriptions.Clear();&lt;/p&gt;  &lt;p&gt;view.SortDescriptions.Add(new SortDescription(sortColumn.Tag as string, direction));&lt;/p&gt;  &lt;p&gt;view.Refresh();&lt;/p&gt;  &lt;p&gt;Questions:&lt;/p&gt;  &lt;p&gt;1. In step 1, why column “Machine” is sorted when I try to sort column “Test Enabled”?&lt;/p&gt;  &lt;p&gt;2. In step 3, 4, why wouldn’t the list view change anymore?&lt;/p&gt;  &lt;p&gt;Picture 1:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/jaimer/WindowsLiveWriter/WPFdiscussions08082009_131DB/clip_image001_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image001" border="0" alt="clip_image001" src="http://blogs.msdn.com/blogfiles/jaimer/WindowsLiveWriter/WPFdiscussions08082009_131DB/clip_image001_thumb.jpg" width="244" height="140" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Picture 2:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/jaimer/WindowsLiveWriter/WPFdiscussions08082009_131DB/clip_image002_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image002" border="0" alt="clip_image002" src="http://blogs.msdn.com/blogfiles/jaimer/WindowsLiveWriter/WPFdiscussions08082009_131DB/clip_image002_thumb.jpg" width="244" height="142" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Picture 3:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/jaimer/WindowsLiveWriter/WPFdiscussions08082009_131DB/clip_image003_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image003" border="0" alt="clip_image003" src="http://blogs.msdn.com/blogfiles/jaimer/WindowsLiveWriter/WPFdiscussions08082009_131DB/clip_image003_thumb.jpg" width="244" height="146" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Picture 4:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/jaimer/WindowsLiveWriter/WPFdiscussions08082009_131DB/clip_image004_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image004" border="0" alt="clip_image004" src="http://blogs.msdn.com/blogfiles/jaimer/WindowsLiveWriter/WPFdiscussions08082009_131DB/clip_image004_thumb.jpg" width="244" height="146" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&lt;strong&gt;Answer&lt;/strong&gt;:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;LCV.CustomSort only specifies the comparer, the actual algorithm is implemented by Array.Sort (it’s a Quicksort). &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;When you click the ‘Test Enabled’ column, we sort by that column only.&amp;#160; Since all the values in that column are equal, &lt;i&gt;any&lt;/i&gt; permutation of the rows is sorted.&amp;#160; The actual result depends on the implementation of the sort algorithm, not on the data at all.&amp;#160; (In other words, it’s not really true that it sorts by ‘Machine’;&amp;#160; all you can say is that the algorithm permutes the rows in some arbitrary way.)&amp;#160; When you click the column again and nothing changes, that only means that Array.Sort produces the same result given the same input – not terribly surprising.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;It’s pretty difficult to implement a sorting algorithm that is both stable (records with equal keys end up in the same relative order as they began) and efficient (O(n log n) with small coefficient).&amp;#160;&amp;#160;&amp;#160; I think you’ll find that the algorithm Marco pointed to (&lt;/font&gt;&lt;a href="http://thomas.baudel.name/Visualisation/VisuTri/inplacestablesort.html) is"&gt;&lt;font color="#008000"&gt;http://thomas.baudel.name/Visualisation/VisuTri/inplacestablesort.html) is&lt;/font&gt;&lt;/a&gt;&lt;font color="#008000"&gt; quite a bit slower than Quicksort in practice.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;There’s no way to replace the sorting algorithm used by the collection view.&amp;#160; If you want a more intuitively deterministic result, you can add a second SortDescription that says how to compare records that are equal w.r.t. the first SortDescription.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;BTW, your code actually sorts the array twice.&amp;#160; The collection view automatically refreshes whenever you change the sort descriptions, so you sort once for view.SD.Add() and a second time for view.Refresh().&amp;#160;&amp;#160; If you added a second SortDescription, you’d sort three times.&amp;#160; The right way to do it is:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; using (view.DeferRefresh())&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; view.SortDescriptions.Clear();&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; view.SortDescriptions.Add(….);&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; view.SortDescriptions.Add(…);&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;This turns off the automatic refresh until you’re done changing things.&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9862566" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jaimer/archive/tags/Windows+Presentation+Foundation/default.aspx">Windows Presentation Foundation</category><category domain="http://blogs.msdn.com/jaimer/archive/tags/wpfdiscussion/default.aspx">wpfdiscussion</category></item><item><title>RenderTargetBitmap tips</title><link>http://blogs.msdn.com/jaimer/archive/2009/07/03/rendertargetbitmap-tips.aspx</link><pubDate>Fri, 03 Jul 2009 22:33:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9817000</guid><dc:creator>jaimer</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/jaimer/comments/9817000.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jaimer/commentrss.aspx?PostID=9817000</wfw:commentRss><description>&lt;p&gt;Quite often,&amp;nbsp; I run into the “RenderTargeBitmap gave me an empty image” or “RenderTargetBitmap did not render my visual”..&amp;nbsp;&amp;nbsp; &lt;br&gt;Hint: this happens a lot to people putting stuff into StackPanels. &lt;/p&gt; &lt;p&gt;The problem is that renderTargetBitmap is working at the Visual layer to render the visual and to do the rendering, it looks at the local properties of the visual (as expected). &lt;br&gt;Layout happens at a different (higher) layer in the platform but often ‘parents’ to your visual will apply offsets or transforms to your visual to position it, since the parent is setting these properties on your actual visual, these properties will be picked up by RenderTargetBitmap logic. &lt;br&gt;&lt;br&gt;The best (and simplest) workaround I have seen came from Adam Smith ( WPF team lead and reliable WPF know it all). It simply wraps the Visual into a VisualBrush that it then draws into a DrawingContext. &lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;private static &lt;/span&gt;&lt;span style="color: #2b91af"&gt;BitmapSource &lt;/span&gt;CaptureScreen(&lt;span style="color: #2b91af"&gt;Visual &lt;/span&gt;target, &lt;span style="color: blue"&gt;double &lt;/span&gt;dpiX, &lt;span style="color: blue"&gt;double &lt;/span&gt;dpiY)
{
    &lt;span style="color: blue"&gt;if &lt;/span&gt;(target == &lt;span style="color: blue"&gt;null&lt;/span&gt;)
    {
        &lt;span style="color: blue"&gt;return null&lt;/span&gt;;
    }
    &lt;span style="color: #2b91af"&gt;Rect &lt;/span&gt;bounds = &lt;span style="color: #2b91af"&gt;VisualTreeHelper&lt;/span&gt;.GetDescendantBounds(target);
    &lt;span style="color: #2b91af"&gt;RenderTargetBitmap &lt;/span&gt;rtb = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;RenderTargetBitmap&lt;/span&gt;((&lt;span style="color: blue"&gt;int&lt;/span&gt;)(bounds.Width * dpiX / 96.0),
                                                    (&lt;span style="color: blue"&gt;int&lt;/span&gt;)(bounds.Height * dpiY / 96.0),
                                                    dpiX,
                                                    dpiY,
                                                    &lt;span style="color: #2b91af"&gt;PixelFormats&lt;/span&gt;.Pbgra32);
    &lt;span style="color: #2b91af"&gt;DrawingVisual &lt;/span&gt;dv = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DrawingVisual&lt;/span&gt;();
    &lt;span style="color: blue"&gt;using &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;DrawingContext &lt;/span&gt;ctx = dv.RenderOpen())
    {
        &lt;span style="color: #2b91af"&gt;VisualBrush &lt;/span&gt;vb = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;VisualBrush&lt;/span&gt;(target);
        ctx.DrawRectangle(vb, &lt;span style="color: blue"&gt;null&lt;/span&gt;, &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Rect&lt;/span&gt;(&lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Point&lt;/span&gt;(), bounds.Size));
    }
    rtb.Render(dv);
    &lt;span style="color: blue"&gt;return &lt;/span&gt;rtb;
}&lt;/pre&gt;
&lt;p&gt;I like that workaround the best, and that is the one I use most of the time.&amp;nbsp; &lt;br&gt;I know other people who workaround this same issue by wrapping the visual they are going to RTB in a Border. This abstracts any transforms that were being applied by the original parent, and now RTB works well.&amp;nbsp; I obviously don’t like this one as much since it ‘imposes’ on my Visual Trees.&amp;nbsp; Still, it works, so it is a choice. &lt;br&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Here is a screenshot of a &lt;a href="http://www.cookingwithxaml.com/recipes/rendertargetbitmap/RenderTargetBitmapSample.zip"&gt;sample&lt;/a&gt; demonstrating the issue and the solutions:&lt;/p&gt;
&lt;p&gt;&lt;img style="border-right-width: 0px; margin: 0px 0px 0px 10px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" align="right" src="http://blogs.msdn.com/blogfiles/jaimer/WindowsLiveWriter/RenderTargetBitmaptips_975E/image_thumb.png" width="315" height="310"&gt;&lt;br&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The first column is the original images and buttons. They are all in a StackPanel.&amp;nbsp; The top 3 items in this panels are not wrapped inside a border, the latter 3 are wrapped in a border. &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The second column, shows what you would get if you just use RenderTargetBitmap.&amp;nbsp; Notice that the button and second image are missing; the reason is cause the StackPanel is offsetting them and RTB is picking that up.&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;Do notice that even with no special workaround, the ones wrapped in the border worked OK. &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The third column shows all the items rendered with the workaround above. Note that it works for all items, including the ones that had border. &lt;/p&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;The source code for this small sample (including the workaround) is &lt;a href="http://www.cookingwithxaml.com/recipes/rendertargetbitmap/RenderTargetBitmapSample.zip"&gt;here&lt;/a&gt;. &lt;br&gt;&lt;br&gt;While I am into RenderTargetBitmap, a reminder to look at this &lt;a href="http://support.microsoft.com/kb/967634/"&gt;KB article (and or QFE).&lt;/a&gt; &lt;br&gt;In 3.5 SP1, we fixed a few leaks for RenderTargetBitmap, but there is still one open; it has to do with doing RenderTargetBitmap of a 3D scene that has VisualBrushes inside the scene. &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9817000" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jaimer/archive/tags/Windows+Presentation+Foundation/default.aspx">Windows Presentation Foundation</category><category domain="http://blogs.msdn.com/jaimer/archive/tags/RenderTargetBitmap/default.aspx">RenderTargetBitmap</category></item><item><title>WPF discussions 090626</title><link>http://blogs.msdn.com/jaimer/archive/2009/06/29/wpf-discussions-090626.aspx</link><pubDate>Mon, 29 Jun 2009 10:12:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9808255</guid><dc:creator>jaimer</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/jaimer/comments/9808255.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jaimer/commentrss.aspx?PostID=9808255</wfw:commentRss><description>&lt;p&gt;Emails from our MS internal discussions. Lots a great tips. &lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;strong&gt;Subject: &lt;/strong&gt;Advise for running WPF apps over Citrix&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&lt;strong&gt;Answer:        &lt;br /&gt;&lt;/strong&gt;All versions of WPF since WPF 3.5 SP1 have remoted (both with Remote Desktop and Terminal Server) using Bitmap Remoting.       &lt;br /&gt;      &lt;br /&gt;Bitmap remoting works as follows:&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font color="#008000"&gt;The application is rendered on the server using WPF’s software rasterizer&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font color="#008000"&gt;As the application runs, the server keeps track of which regions of the application’s window are newly dirty and need to be updated&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font color="#008000"&gt;When a region needs to be updated, the server creates a compressed bitmap of just the dirty region and sends that to the client&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font color="#008000"&gt;Once the client has drawn that bitmap to the appropriate place on its own window, the client window is up-to-date&lt;/font&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;font color="#008000"&gt;Given how this remoting mechanism works, performance can be maximized in several ways:&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font color="#008000"&gt;Dirty regions should be kept as small as possible so the least amount of data is sent over the wire&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font color="#008000"&gt;Ambient animations should be turned off&lt;/font&gt;       &lt;ul&gt;       &lt;li&gt;&lt;font color="#008000"&gt;For instance, setting a window background to an animating gradient would cause the entire window to be invalidated / redrawn every frame&lt;/font&gt; &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;font color="#008000"&gt;The system does not optimize away occluded parts of the application&lt;/font&gt;       &lt;ul&gt;       &lt;li&gt;&lt;font color="#008000"&gt;For instance, an animation that is completely hidden behind some other opaque element will &lt;i&gt;still&lt;/i&gt; cause dirty region invalidation / bitmap generation to occur.&amp;#160; Remove these from your application.&lt;/font&gt; &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;font color="#008000"&gt;Dirty regions should be created as infrequently as possible&lt;/font&gt;       &lt;ul&gt;       &lt;li&gt;&lt;font color="#008000"&gt;Turn off as many animations as possible&lt;/font&gt; &lt;/li&gt;        &lt;li&gt;&lt;font color="#008000"&gt;For those animations that can’t be eliminated completely, lower the animation framerate using the DesiredFramerate property&lt;/font&gt; &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;font color="#008000"&gt;Dirty Region Bitmaps should be as simple as possible to maximize their compression&lt;/font&gt;       &lt;ul&gt;       &lt;li&gt;&lt;font color="#008000"&gt;Application running over TS should favor solid colors over gradients or other exotic fills (unnecessary images, etc), especially for application pieces that will be redrawn frequently&lt;/font&gt; &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;&lt;font color="#008000"&gt;Avoid operations that are especially slow when rendered in software&lt;/font&gt;       &lt;ul&gt;       &lt;li&gt;&lt;font color="#008000"&gt;BitmapEffects / Effects / ShaderEffects, especially blurs and drop shadows with large radii, are quite slow in software&lt;/font&gt; &lt;/li&gt;        &lt;li&gt;&lt;font color="#008000"&gt;3D – the 3D software rasterizer is substantially slower than rendering in hardware&lt;/font&gt; &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;strong&gt;Subject: &lt;/strong&gt;Is there any support in WPF for “bottom-up” bitmaps?     &lt;br /&gt;I’m using BitmapSource.Create with an unmanaged memory buffer. The buffer comes from a Win32 DIBSection with a +ve height, which indicates a &lt;a href="http://msdn.microsoft.com/en-us/library/dd407212(VS.85).aspx"&gt;bottom-up DIB&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&lt;strong&gt;Answer:        &lt;br /&gt;&lt;/strong&gt;Wrap it in a TransformedBitmap.&amp;#160; &lt;br /&gt;return new TransformedBitmap(bmp, new ScaleTransform(1,-1));&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;[extra tip]      &lt;br /&gt;Note that I think each call to CopyPixels() on the TransformedBitmap will run the scale transformation again. You can avoid this by caching the result in a CachedBitmap and using the CB instead       &lt;br /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; Getting DependencyProperty value from WinDBG     &lt;br /&gt;I have a dump of a WPF process and am trying to get the value of a DependencyProperty of UIElement.&amp;#160; Does anybody know how this can be done?&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&lt;b&gt;Answer:        &lt;br /&gt;&lt;/b&gt;1. Pull out the value of _packedData.       &lt;br /&gt;2. _packedData &amp;amp; 0x0000FFFF will give you the GlobalIndex.       &lt;br /&gt;3. Go to the DependencyObject on which you want to query the property and get access to the _effectiveValues array.       &lt;br /&gt;4. Go through the EffectiveValueEntry objects, looking at the _propertyIndex field until it matches the index you calculated in step 2 (the array should be sorted by property index).       &lt;br /&gt;5. _value is the value of the property on that DependencyObject.&lt;/font&gt;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;strong&gt;Subject:&amp;#160; &lt;/strong&gt;Difference between nulll and x:Null for brushes&lt;/p&gt;  &lt;p&gt;I know there is a difference but I can’t remember. I think it had something to do with hit testing (but I can’t remember for sure).&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&lt;strong&gt;Answer:        &lt;br /&gt;&lt;/strong&gt;No difference.&amp;#160; You're probably thinking of null (No hit test) versus Transparent (Can be hit).&lt;/font&gt;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; Disable auto-word selection in FlowDocumentViewer     &lt;br /&gt;How can I make FlowDocumentViewer select character by character when I use the mouse? &lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&lt;strong&gt;Answer:        &lt;br /&gt;&lt;/strong&gt;For FlowDocumentPageViewer, you can use flowDocumentPageViewer.SetValue(TextBoxBase.AutoWordSelectionProperty, false). FlowDocumentScrollViewer doesn’t auto-select words by default. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;Internally, the selection code shared by text boxes and FlowDocument viewers relies on TextBoxBase.AutoWordSelectionProperty. We don’t currently expose the property on anything other than TextBoxBase. &lt;/font&gt;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; Blend units.     &lt;br /&gt;Any reason why Blend3 outputs font size in WPF “units” and not the actual pt value. If I change the FontSize on a TextBlock to “11pt”, 14.667 is written out.     &lt;br /&gt;    &lt;br /&gt;&lt;font color="#008000"&gt;&lt;strong&gt;Answer:        &lt;br /&gt;&lt;/strong&gt;Blend 2 always displayed text units in pixels. This was confusing to most designers who are used to thinking of fonts in terms of points. In Blend 3 we added an option where you can choose whether you want points or pixels as your display in the Property panel. This is under the Units tab in the Options dialog.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;In terms of the XAML output, we had wanted to output the same units as shown in the UI but Silverlight does not support the pt syntax in XAML so we decided (for cost and consistency reasons) to just leave it as pixels in the XAML for V3.&amp;#160; It is something for us to consider improving in the future though.&lt;/font&gt;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; Disable IME on TextBox     &lt;br /&gt;Is there a setting to disable using IME on a textbox, or some other means of not allowing a user to use it?&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&lt;strong&gt;Answer:        &lt;br /&gt;&lt;/strong&gt;&amp;lt;TextBox InputMethod.IsInputMethodEnabled=”false” /&amp;gt;&lt;/font&gt;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; DateTime property in the Properties editor of Blend     &lt;br /&gt;I have a question regarding how Blend handles a control property which is of type System.DateTime.&amp;#160; I am trying to understand how the property editor would interpret a string such as 20/05/2001. Would it take into account the regional settings of the computer or is it tied up with the implementation of the control itself?&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&lt;strong&gt;Answer:        &lt;br /&gt;&lt;/strong&gt;Blend will use a text editor to read and display DateTimes, and will parse input based on the locale settings of your machine.&amp;#160; In xaml, it is always stored in an invariant format(year-month-day).&lt;/font&gt;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;strong&gt;Subject:&amp;#160; &lt;/strong&gt;(summarized) issue w/ WPF not matching GDI on how a custom font is rendered&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&lt;strong&gt;Answer:        &lt;br /&gt;&lt;/strong&gt;There is no expectation that WPF font rasterization will match GDI\GDI+ rasterization. For example if the font does not have italic or bold variants GDI will emulate bold and italic WPF will not.&lt;/font&gt;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; DPI interop issues...&lt;/p&gt;  &lt;p&gt;I have a drag/drop gesture that draws a drag/drop feedback in a transparent WPF window. The problem is in tracking the mouse position I had to use interop to Win32.GetCursorPos and that works, when the operating system is in 96 DPI mode.&amp;#160; But when you change the OS DPI to something else, like 120 or 150 DPI then this doesn’t work because positioning the transparent WPF drag/drop feedback window requires WPF device independent coordinates (essentially 96 DPI) so I need to do a conversion&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;     &lt;br /&gt;&lt;font color="#008000"&gt;Answer:        &lt;br /&gt;&lt;/font&gt;&lt;/strong&gt;&lt;font color="#008000"&gt;Have you looked at Visual.PointFromScreen?&amp;#160; It can be used to convert screen coordinates from APIs such as GetCursorPos into Device Independent Units &lt;/font&gt;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;strong&gt;Subject: Game loops in WPF?      &lt;br /&gt;&lt;/strong&gt;wondering how easy it would be to write a custom &amp;quot;game loop&amp;quot; within the WPF framework. By game loop, I mean pumping my own events on a custom Dispatcher so I can control the framerate of my app.&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&lt;strong&gt;Answer:        &lt;br /&gt;&lt;/strong&gt;You can write your own message pump. Just don't call Dispatcher.Run. You need to pump messages, and you need to call ComponentDispatcher.RaiseThreadMessage as appropriate. Use reflector to see what Dispatcher.PushFrame does.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;Of course, this still may not give you what you want for a &amp;quot;game loop&amp;quot;... &lt;/font&gt;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;font color="#000000"&gt;&lt;b&gt;Subject:&lt;/b&gt; Is there a way to prevent exception if DataContext is null? &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000"&gt;This is just an example.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000"&gt;I have a Image which is Databind to some dynamic source (image source) and it works fine and it is all done in xaml. Can we provide some defaule image source incase DataContext becomes null? &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Answer:&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;FallbackValue is your friend: &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.data.bindingbase.fallbackvalue.aspx"&gt;&lt;font color="#008000"&gt;http://msdn.microsoft.com/en-us/library/system.windows.data.bindingbase.fallbackvalue.aspx&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;font color="#000000"&gt;&lt;b&gt;Subject:&lt;/b&gt; Listening to selective ETW Events&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000"&gt;I’m writing performance tests where we want to listen to the WClientUceNotifyPresent ETW event to calculate frame rates.&amp;#160; However, I haven’t found provider flags to listen to it, along with a limited set of other events.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#008000"&gt;Answer:&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;With WPF 3.0-3.5 you unfortunately don’t have a lot of options.&amp;#160; You should make sure that you’re using verbosity level 4 (as opposed to 5).&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;If you’re on CLR 4.0 we have much more granular flags so you’ll be able to turn on a flag specifically for Graphics related events which should help .&amp;#160; If you have a recent drop (post Beta1) you should find our event manifest installed in \windows\microsoft.net\framework\v4.0\wpf\wpf-etw.man which lists the available flags.&amp;#160; You will need either flag 1 `General` or flag 0x1000 `Graphics` depending on what drop you have.&lt;/font&gt;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;font color="#000000"&gt;&lt;b&gt;Subject:&lt;/b&gt; Way to check if an UIElement is visible in ScrollViewer&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000"&gt;Is there any way to check if an UI element is already showing in a scroll viewer?&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&lt;strong&gt;Answer:        &lt;br /&gt;&lt;/strong&gt;&lt;/font&gt;&lt;font color="#008000"&gt;[Not right one, but works]      &lt;br /&gt;&lt;/font&gt;&lt;font color="#008000"&gt;Use reflection to invoke ScrollViewer.IsInViewport method?&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;[Final]      &lt;br /&gt;&lt;/font&gt;&lt;font color="#008000"&gt;I wouldn’t recommend this for production code.      &lt;br /&gt;&lt;/font&gt;&lt;font color="#008000"&gt;Is there a reason you don’t want to call BringIntoView on elements that are already visible? All handlers of RequestBringIntoView I know of no-op on visible elements.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&amp;#160;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9808255" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jaimer/archive/tags/Windows+Presentation+Foundation/default.aspx">Windows Presentation Foundation</category><category domain="http://blogs.msdn.com/jaimer/archive/tags/wpfdiscussion/default.aspx">wpfdiscussion</category></item><item><title>New release of WPF Toolkit, now with charts! </title><link>http://blogs.msdn.com/jaimer/archive/2009/06/25/new-release-of-wpf-toolkit-now-with-charts.aspx</link><pubDate>Fri, 26 Jun 2009 07:57:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9804781</guid><dc:creator>jaimer</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/jaimer/comments/9804781.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jaimer/commentrss.aspx?PostID=9804781</wfw:commentRss><description>&lt;P&gt;The &lt;A href="http://wpf.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=29117" target=_blank mce_href="http://wpf.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=29117"&gt;June release of the WPF toolkit&lt;/A&gt; went live today, it now includes the charts &lt;A href="http://blogs.msdn.com/blogfiles/jaimer/WindowsLiveWriter/NewreleaseofWPFToolKiTNOWWITHCHARTS_134BD/image_2.png" mce_href="http://blogs.msdn.com/blogfiles/jaimer/WindowsLiveWriter/NewreleaseofWPFToolKiTNOWWITHCHARTS_134BD/image_2.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; MARGIN: 0px 0px 0px 25px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image align=right src="http://blogs.msdn.com/blogfiles/jaimer/WindowsLiveWriter/NewreleaseofWPFToolKiTNOWWITHCHARTS_134BD/image_thumb.png" width=263 height=209 mce_src="http://blogs.msdn.com/blogfiles/jaimer/WindowsLiveWriter/NewreleaseofWPFToolKiTNOWWITHCHARTS_134BD/image_thumb.png"&gt;&lt;/A&gt;that come with the Silverlight toolkit. &lt;BR&gt;&lt;BR&gt;&lt;A href="http://blogs.msdn.com/delay" target=_blank mce_href="http://blogs.msdn.com/delay"&gt;David Anson&lt;/A&gt; has the scoop and a great sample on the &lt;A title=charts href="http://blogs.msdn.com/delay/archive/2009/06/25/wpf-charting-it-s-official-june-2009-release-of-the-wpf-toolkit-is-now-available.aspx" mce_href="http://blogs.msdn.com/delay/archive/2009/06/25/wpf-charting-it-s-official-june-2009-release-of-the-wpf-toolkit-is-now-available.aspx"&gt;charts&lt;/A&gt;.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;The other controls (Datagrid, VSM, and DatePicker) also include a few minor fixes (check the &lt;A href="http://wpf.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=29117" target=_blank mce_href="http://wpf.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=29117"&gt;release notes&lt;/A&gt;). &lt;BR&gt;&amp;nbsp; &lt;BR&gt;There is not an update for the WPF ribbon; we are still hopingthe update to ribbon comes after (or around same time) as .NET4 beta2.&amp;nbsp; &lt;BR&gt;&lt;BR&gt;Enjoy the charts and the new toolkit, please don’t forget to send feedback. &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=1&gt;PS. – Congrats to David Anson for the release; he has been the biggest advocate for the charts making it into WPF. I am sure he put some ‘over-time’ given how much they are doing with the Silverlight control toolkit too.&amp;nbsp; Thanks David! &lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9804781" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jaimer/archive/tags/Windows+Presentation+Foundation/default.aspx">Windows Presentation Foundation</category><category domain="http://blogs.msdn.com/jaimer/archive/tags/silverlight/default.aspx">silverlight</category></item><item><title>THANKS CHICAGO. Here is the content.</title><link>http://blogs.msdn.com/jaimer/archive/2009/06/16/thanks-chicago-here-is-the-content.aspx</link><pubDate>Wed, 17 Jun 2009 09:56:11 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9767163</guid><dc:creator>jaimer</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/jaimer/comments/9767163.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jaimer/commentrss.aspx?PostID=9767163</wfw:commentRss><description>&lt;p&gt;Last friday, we had the pleasure of delivering the last stop in the WPF for LOB tour: Chicago. &lt;a href="http://blogs.msdn.com/blogfiles/jaimer/WindowsLiveWriter/THANKSCHICAGO.Hereisthecontent_15095/ChicagoXamlized_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="ChicagoXamlized" border="0" alt="ChicagoXamlized" align="right" src="http://blogs.msdn.com/blogfiles/jaimer/WindowsLiveWriter/THANKSCHICAGO.Hereisthecontent_15095/ChicagoXamlized_thumb.jpg" width="192" height="317" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;The training was very lively, with lots of people from all over the mid-west, and a few people from other further places…&amp;#160; It was a lot of fun at a good location (despite a shaky start with a microphone, that only lasted 45 mins ).&amp;#160; Definitely a good way to finish the tour..    &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;The content for Chicago is now posted:&amp;#160; &lt;a href="http://www.cookingwithxaml.com/content/ChicagoLob/decks.zip" target="_blank"&gt;Decks&lt;/a&gt;&amp;#160; and &lt;a href="http://www.cookingwithxaml.com/content/ChicagoLob/demos.zip" target="_blank"&gt;demos&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Thanks to all the Chicago attendees!! &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;And thanks to every one else who helped us with the tour.&amp;#160; This has been a lot of fun and very enlightening and inspiring to us.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9767163" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jaimer/archive/tags/Windows+Presentation+Foundation/default.aspx">Windows Presentation Foundation</category><category domain="http://blogs.msdn.com/jaimer/archive/tags/mvvm/default.aspx">mvvm</category></item><item><title>WPF in LOB TOUR, PHOENIX CONTENT</title><link>http://blogs.msdn.com/jaimer/archive/2009/06/10/wpf-in-lob-tour-phoenix-content.aspx</link><pubDate>Wed, 10 Jun 2009 11:02:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9723621</guid><dc:creator>jaimer</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/jaimer/comments/9723621.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jaimer/commentrss.aspx?PostID=9723621</wfw:commentRss><description>&lt;p&gt;Last week’s stop in the WPF for LOB tour was Phoenix.&amp;#160;&amp;#160; &lt;a href="http://blogs.msdn.com/blogfiles/jaimer/WindowsLiveWriter/WPFinLOBTOURPHOENIXCONTENT_E95/PHXXAMLIXED_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="PHXXAMLIXED" border="0" alt="PHXXAMLIXED" align="right" src="http://blogs.msdn.com/blogfiles/jaimer/WindowsLiveWriter/WPFinLOBTOURPHOENIXCONTENT_E95/PHXXAMLIXED_thumb.jpg" width="244" height="184" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Great weather, a great audience, and good times.    &lt;br /&gt;Having been twice in Phoenix this month I have to say they have a really great .NET community. Congratulations and thanks for joining us for the training!! &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Here are the &lt;a href="http://www.cookingwithxaml.com/content/phxlob/decks.zip" target="_blank"&gt;decks&lt;/a&gt; and the &lt;a href="http://www.cookingwithxaml.com/content/phxlob/demos.zip" target="_blank"&gt;demos&lt;/a&gt;. &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;strong&gt;Thanks again Phoenix!!&amp;#160;&amp;#160; &lt;/strong&gt;Next stop: Chicago; c u there on friday. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;My guess is that most Americans know this, but I did not.&amp;#160; The picture is from a well known place in Phoenix, called Camelback mountain.&amp;#160; &lt;br /&gt;Courtesy of Terry Stanley, a training attendee (and now a XAML expert).     &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9723621" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jaimer/archive/tags/Windows+Presentation+Foundation/default.aspx">Windows Presentation Foundation</category></item><item><title>Programming differences between WPF and SIlverlight, a WHitePaper</title><link>http://blogs.msdn.com/jaimer/archive/2009/06/09/programming-differences-between-wpf-and-silverlight-a-whitepaper.aspx</link><pubDate>Tue, 09 Jun 2009 19:46:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9716471</guid><dc:creator>jaimer</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/jaimer/comments/9716471.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jaimer/commentrss.aspx?PostID=9716471</wfw:commentRss><description>&lt;p&gt;Wintellect just posted a great &lt;a href="http://wpfslguidance.codeplex.com/"&gt;70 page white paper on codeplex&lt;/a&gt; about the “&lt;a href="http://wpfslguidance.codeplex.com/"&gt;programming differences between WPF and Silverlight&lt;/a&gt;”.&amp;nbsp;&amp;nbsp; &lt;/p&gt; &lt;p&gt;I have not dissected it yet, but from a quick scan it looks very useful. &lt;br&gt;I will be printing it and dissecting it on my flight to the next (and last) &lt;a href="http://blogs.msdn.com/jaimer/archive/2009/04/01/announcing-the-using-wpf-to-build-lob-applications-training-tour.aspx"&gt;WPF for LOB Tour&lt;/a&gt; stop: Chicago. &lt;br&gt;&lt;/p&gt; &lt;p&gt;Please share feedback on the paper.&amp;nbsp;&amp;nbsp; Is it useful?? What is it missing?? Is it a fair assessment of the status on our continuum.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9716471" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jaimer/archive/tags/Windows+Presentation+Foundation/default.aspx">Windows Presentation Foundation</category><category domain="http://blogs.msdn.com/jaimer/archive/tags/silverlight/default.aspx">silverlight</category><category domain="http://blogs.msdn.com/jaimer/archive/tags/xaml/default.aspx">xaml</category></item><item><title>WPF discussion 090605</title><link>http://blogs.msdn.com/jaimer/archive/2009/06/06/wpf-discussion-090605.aspx</link><pubDate>Sun, 07 Jun 2009 09:46:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9703629</guid><dc:creator>jaimer</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/jaimer/comments/9703629.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jaimer/commentrss.aspx?PostID=9703629</wfw:commentRss><description>&lt;p&gt;You know the drill: Raw/unedited WPF discussions from inside the mothership. &lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;strong&gt;Subject: Accessibility tree, and collapsed elements&lt;/strong&gt; &lt;/p&gt;  &lt;p&gt;We have some UI that we’re collapsing (Visibility=Collapsed). However, even after it’s collapsed, it *seems* to be participating in the accessibility tree (shows up in UIspy). Is this the correct behaviour? &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#008000"&gt;Answer:        &lt;br /&gt;&lt;/font&gt;&lt;/strong&gt;&lt;font color="#008000"&gt;It seems that this behavior is expected. However UI Elements that are collapsed should have the IsOffScreen property set to true. You could probably filter on that flag.&lt;/font&gt;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; Blur the focus of a window&lt;/p&gt;  &lt;p&gt;With WPF, how can you blur (lose focus) a window?&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&lt;strong&gt;Answer1:&lt;/strong&gt;       &lt;br /&gt;There are essentially 3 types of focus, which type do you want to blur?&amp;#160; There are:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;· Logical focus.&amp;#160; This is essentially a way of marking which IInputElement in a given scope should receive keyboard focus if that scope gains keyboard focus.&amp;#160; Within elements that are marked as a focus scope, there will be 0 or 1 logically-focused child elements.&amp;#160; A focus scope is determined by FocusManager.SetIsFocusScope/FocusManager.GetIsFocusScope, and logical focus can be cleared by using FocusManager.SetFocusedElement on the focus scope to null.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;· Keyboard focus.&amp;#160; This is similar to Win32 focus; only one IInputElement on the thread with Win32 focus can be the Keyboard.FocusedElement.&amp;#160; In 3.0/3.5/3.5 SP1, the only way I know of to clear WPF keyboard focus also involves clearing Win32 focus, by calling ::SetFocus(NULL) from user32.&amp;#160; In WPF 4.0 there is a new method coming along, Keyboard.ClearFocus(), which will clear only the WPF keyboard focus.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;· Standard Win32 focus.&amp;#160; WPF keyboard focus is typically kept in-sync with Win32 focus (in that the focused HWND typically contains the Keyboard.FocusedElement), so doing operations which affect HWND focus will generally affect the Keyboard.FocusedElement.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#008000"&gt;Answer2:&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;Of course, you can always make an element lose focus by focusing another element, too.&amp;#160; Calling Keyboard.Focus on some other element should result in PreviewLostKeyboardFocus/LostKeyboardFocus being raised on the element losing keyboard focus.&amp;#160; Similarly, calling FocusManager.SetFocusedElement to some other element in the focus scope should result in PreviewLostFocus/LostFocus being raised on the element losing logical focus.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;Confusingly, perhaps, calling Keyboard.Focus(null) will not clear keyboard focus, but will instead focus the active PresentationSource's root visual.&amp;#160; This can result in Keyboard.Focus(null) actually focusing another element, and not clearing focus.&lt;/font&gt;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; How do I change properties on the Navigation Bar in a WPF Frame?&lt;/p&gt;  &lt;p&gt;I'm working on a page based WPF application, and I want to change the size of the navigation bar in the Frame hosting my pages. I set NavigationUIVisibility=&amp;quot;Visible&amp;quot; in order to see the navigation bar, now how do I change properties on the navigation bar like it's size?&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&lt;strong&gt;Answer:        &lt;br /&gt;&lt;/strong&gt;&lt;/font&gt;&lt;font color="#008000"&gt;The built-in navigation UI is not directly customizable. You’ll have to replace the entire ControlTemplate of Frame, possibly using the built-in one as a base. This is easy with Blend. Some resources:      &lt;br /&gt;&lt;/font&gt;&lt;a href="http://windowsclient.net/downloads/folders/wpfsamples/entry5121.aspx"&gt;&lt;font color="#008000"&gt;http://windowsclient.net/downloads/folders/wpfsamples/entry5121.aspx&lt;/font&gt;&lt;/a&gt;     &lt;br /&gt;&lt;a href="http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/c98f9b2a-a910-45cd-acdc-fa5b222b7460/"&gt;&lt;font color="#008000"&gt;http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/c98f9b2a-a910-45cd-acdc-fa5b222b7460/&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; Scroll issue with hosting a winform within WPF&lt;/p&gt;  &lt;p&gt;I am having an issue trying to scroll a winform control hosted within WPF. I have a view (WPF UserControl) that has 3 elements. A checkbox, a hosted winform control (gray window below) and a combobox.    &lt;br /&gt;    &lt;br /&gt;&lt;strong&gt;&lt;font color="#008000"&gt;Answer:        &lt;br /&gt;&lt;/font&gt;&lt;/strong&gt;&lt;font color="#008000"&gt;Here’s an illustration of this technique for another source: &lt;/font&gt;&lt;a href="http://blogs.msdn.com/ryanvog/archive/2009/01/20/clipping-legacy-content-hosted-inside-a-wpf-scrolling-region.aspx"&gt;&lt;font color="#008000"&gt;http://blogs.msdn.com/ryanvog/archive/2009/01/20/clipping-legacy-content-hosted-inside-a-wpf-scrolling-region.aspx&lt;/font&gt;&lt;/a&gt;&lt;font color="#008000"&gt;. &lt;/font&gt;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; RE: Themes\Generic.xaml&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&lt;strong&gt;Answer:        &lt;br /&gt;&lt;/strong&gt;Only resources that are referenced with StaticResource from within the same resource dictionary (i.e. within Generic.xaml) can be strings. For everything else, you must use either a type key ({x:Type Foo}) or a ComponentResourceKey. Styles with no key specified default the key value to the TargetType of the Style.&lt;/font&gt;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; Asynchronous Commands and Dispatcher&lt;/p&gt;  &lt;p&gt;I have a command which executes a long-running operation using BackgroundWorker.&amp;#160; The command exposes a State property to which the UI can be bound to indicate that the operation is in progress or has finished.&amp;#160; The results of the command are bound to a TreeView.&amp;#160; Whenever an element is added to the results, the command does so by calling Dispatcher.BeginInvoke so that the element will be added to the results collection on the UI which causes the TreeView to be updated.&amp;#160; I call the BeginInvoke method with a priority of Background.&amp;#160; Once the command is finished executing, it updates its state to say it’s finished.&amp;#160; &lt;/p&gt;  &lt;p&gt;The problem is that when there are hundreds of elements that have been added to the collection, the UI thread hasn’t finished processing all of those operations that have been queued on the Dispatcher by the time the command says it’s finished.&amp;#160; So the command says it is finished even though the UI thread is still busy processing all the queued operations.&amp;#160; &lt;/p&gt;  &lt;p&gt;One solution is to have the Command update its State property by having the Dispatcher do it via the BeginInvoke call with the same priority.&amp;#160; That would cause the Dispatcher to update the Command’s state once all the other previously added operations have been processed.&amp;#160; But I’m not sure that’s the right approach; it feels very hacky.&lt;/p&gt;  &lt;p&gt;Is there a better way to do this?&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&lt;strong&gt;Answer:        &lt;br /&gt;&lt;/strong&gt;&lt;/font&gt;&lt;font color="#008000"&gt;Keep track of the last operation you BeginInvoke over to the UI thread from the worker thread.&amp;#160; When the worker thread is done, before it updates the state property, have it call DispatcherOperation.Wait() to wait for the UI thread to finish.&lt;/font&gt;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; RE: Blocking till message loop empty?&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&lt;strong&gt;Answer:        &lt;br /&gt;&lt;/strong&gt;Nope.&amp;#160; Dispatcher.Invoke, when called on its &lt;u&gt;own thread&lt;/u&gt;, will implicitly use Dispatcher.PushFrame.&lt;/font&gt;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; RE: Bounding rectangle for objects on canvas&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;&lt;strong&gt;Answer: &lt;/strong&gt;      &lt;br /&gt;GetDescendantBounds returns the bounds without applying any Visual properties like Clip, Transform, Offset, Effect…       &lt;br /&gt;Canvas.Left/Canvas.Top are mapped to Visual.VisualOffset and Visual.VisualTransform. To take the bounding box from what we call “inner coordinate space” (closest to children) to “outer coordinate space” (closest to parent) you have to apply all the transforms, clips, etc. Note that an effect might change your transformation too…&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;The easiest way to get the outer bounds is to call on the parent GetDescendantBounds as long as the parent does not have any “vector content” (think ink).&amp;#160; For UIElements you provide “vector content” via OnRender, for DrawingVisual you call RenderOpen, etc. If the parent had any content, it would be included in the descendant bounds. The naming is a little unfortunate since it is not purely “descendant”. We originally had the functionality only consider descendants, but lots of people thought it was what it does now…&lt;/font&gt;&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; Disable script debugging for WebBrowser?&lt;/p&gt;  &lt;p&gt;This option exists in the WinForms web browser, is there a way we can access this option in the WPF web browser also? We are having catastrophic issues with modal script debugger popups that make the browser too annoying to be useful.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#008000"&gt;Answer:&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;Get the native IWebBrowser2 and set the Silent property. See the Community section of the &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.webbrowser.aspx"&gt;&lt;font color="#008000"&gt;WebBrowser class reference&lt;/font&gt;&lt;/a&gt;&lt;font color="#008000"&gt; (&lt;a title="http://msdn.microsoft.com/en-us/library/system.windows.controls.webbrowser.aspx" href="http://msdn.microsoft.com/en-us/library/system.windows.controls.webbrowser.aspx"&gt;http://msdn.microsoft.com/en-us/library/system.windows.controls.webbrowser.aspx&lt;/a&gt;) for how to get IWebBrowser2.&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9703629" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jaimer/archive/tags/Windows+Presentation+Foundation/default.aspx">Windows Presentation Foundation</category><category domain="http://blogs.msdn.com/jaimer/archive/tags/wpfdiscussion/default.aspx">wpfdiscussion</category></item></channel></rss>