Jaime Rodriguez
On Windows Store apps, Windows Phone, HTML and XAML

  • Jaime Rodriguez

    rant to self...

    • 0 Comments

    jaime,  3 weeks again with no posts at all.. lame..

     

     

  • Jaime Rodriguez

    ClipToBounds part2... Applied to ListBox ....

    • 0 Comments

    So, I gave you the secret already ... GetLayoutClip () ...  that is it ...

    MY problem is twice I have sent that answer and they got back to me with "it is still not working" ... mostly because they were trying to do it in a ListBox...  Let's walk through it before we see some code:

    Apply my lazy factor to the scenario:

     This is a listbox with my portfolio ( Stock symbols).. as I MouseOver each ListBox items, it Scales to 150% so I can read the details..  [all you need is to replace the template, for today we will use the same planet datatemplate we used last time, I told you Datatemplates maximized reuse did not I ? 

    Unfortunately, we are not there yet... Right now, the image is being clipped like this and I can't read the (imaginary) details..

     

    So, who is clipping it?  In my experience that varies widely .. 

    To understand why it varies, you must use Reflector and go look at FrameworkElement:GetLayoutClip ...   There are many checks ( MaxWidth/Height) , Margins + RenderSize, etc. that determine what your clip is..  so depending on what you are doing, you might either be clipped by:

    • the ListBox itself,  -- this is almost always true
    • the Panel you are using for your ItemsPanel or ( I don't see this one often)
    • your ListBoxItem.. ( have not seen this a lot other than some creative animations)
    • seldomly your item is clipped in the template itself -for this one do what we did for the button --

    Experience taught me to override all at once; don't leave it to luck or the person replacing you will be puzzled a year from now, when they change some thing in the template and this thing starts clipping ...

    So, attached is a quick & very dirty example -- don't think of it as a best practice, more of a what to look for list' on how to get around some of the usual gotchas..  Here is what it shows:

    1. UCListBox derived from ListBox and override GetLayoutClip ..     (Unclipped.cs)
    2. Override the listBox's ControlTemplate...  The ControlTemplate had a Border, a ScrollViewer, and other items that tend to clip your ListBoxItem.. .(ResourceDictionary1.xaml,  UCListBoxTemplate)
    3. UCListBoxItem derived from ListBoxItem and override GetLayoutClip [ this one I do all the time too, though part of the time you can get away with out it] .. (Unclipped.cs)
      1. Note, if you do that, you need to tell the ListBox ItemGenerator to create your custom ListBoxItems, so override GetContainerForItemOverride ... (Unclipped.cs)
    4. Go back to the XAML and tell it to use my custom UCListBox instead of the ListBox I had earlier ..   ( Scene2.xaml , <lcl:UCListBox Margin... )

     

    OK, I think that is it ... See code attached....  Created using July CTP ... Opens fine in Expression of course..  [but might need to build it once before you can use designer]

     

     

     

     

     

     

     

     

  • Jaime Rodriguez

    Can't get ClipToBounds to work... or why is my content being clipped

    • 2 Comments

    I often get pinged with a "My < insert control or panel here> is clipping ... even though I have set ClipToBounds=false...  is this a bug?" ... 

    It is not a bug; it is just that ( as of today, afaik) the clipping behavior in WPF is not documented completely (yet!)  

    Here is a sample XAML of what I am talking about:

    <Grid
     xmlns="
    http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="
    http://schemas.microsoft.com/winfx/2006/xaml"
     xmlns:mc="
    http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:d="
    http://schemas.microsoft.com/expression/interactivedesigner/2006"
     mc:Ignorable="d"
     Background="#FFFFFFFF"
     x:Name="DocumentRoot"
     Width="640" Height="480" ClipToBounds="False"
    >

     <Grid.Resources>
      <Storyboard x:Key="OnLoaded" RepeatBehavior="5x" >
       <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(RotateTransform.Angle)" Storyboard.TargetName="Rectangle">
         <SplineDoubleKeyFrame d:KeyEase="Linear;Linear;0.5;0.5;0.5;0.5" KeySpline="0.5,0.5,0.5,0.5" Value="360" KeyTime="00:00:02.0" />    
       </DoubleAnimationUsingKeyFrames>
       
       <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(RotateTransform.Angle)" Storyboard.TargetName="Rectangle2">
        <SplineDoubleKeyFrame d:KeyEase="Linear;Linear;0.5;0.5;0.5;0.5" KeySpline="0.5,0.5,0.5,0.5" Value="360" KeyTime="00:00:02.0" />    
       </DoubleAnimationUsingKeyFrames>   
      </Storyboard>
     </Grid.Resources>

     <Grid.Triggers>
      <EventTrigger RoutedEvent="FrameworkElement.Loaded">
       <BeginStoryboard x:Name="OnLoaded_BeginStoryboard" Storyboard="{DynamicResource OnLoaded}"/>
      </EventTrigger>
     </Grid.Triggers>
     
     <Grid.ColumnDefinitions>
      <ColumnDefinition Width="0.20*"/>
      <ColumnDefinition Width="0.20*"/>
      <ColumnDefinition Width="0.58125*"/>
     </Grid.ColumnDefinitions>
     <Grid.RowDefinitions>
      <RowDefinition Height="0.12*"/>
      <RowDefinition Height="0.12*"/>
      <RowDefinition Height="0.76*"/>
     </Grid.RowDefinitions>
     <Button  HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,0,0,0" Width="120" Height="62" Grid.Row="1" Grid.Column="1" ClipToBounds="False" >
      <Rectangle Stroke="#FF000000" Fill="#FFFFFFFF" Width="90" Height="42" x:Name="Rectangle2" RenderTransformOrigin="0.5,0.5">
       <Rectangle.RenderTransform>
        <TransformGroup>
         <RotateTransform Angle="0"/>
        </TransformGroup>
       </Rectangle.RenderTransform>
      </Rectangle>
     </Button>
     
     <Button   HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,0,0,0" Width="120" Height="62" Grid.Row="1" Grid.Column="0" ClipToBounds="False" x:Name="Button" >
      <Rectangle Stroke="#FF000000" Fill="#FFFFFFFF" Width="90" Height="42" x:Name="Rectangle" RenderTransformOrigin="0.5,0.5">
       <Rectangle.RenderTransform>
        <TransformGroup>
          <RotateTransform Angle="0"/>
         </TransformGroup>
       </Rectangle.RenderTransform>
      </Rectangle>
     </Button>
    </Grid>

    **Sorry for lack of graphical creativity, imagine the button is a cool ATM button and the rectangle is an image spinning around telling you "I am doing some work" since the ATM has no cursor ..

    If you run it on XAMLPAd or your favorite XAML Editor..  you will see that

    1) The rectangle is clipping... why??  Both the Button and the Grid have ClipToBounds = false; it should not be clipping right ?

    I use to agree with that until Dmitry, a WPF dev that tends to tolerate all my "dumb questions" around this topic.. shared the skinny... here is a cut & paste from a very old email:

    "There are 3 potential sources of clipping behavior for an element:

    1. UIElement.Clip property – you can set whatever geometry there to achieve some interesting clipping. Defaults to nothing
    2. Layout clip – layout is applying clip geometry computed as transformed layout slot (not layout bounds), to make sure the element does not stick out of layout partition reserved by the parent and does not overlap its siblings. Works always, off in Canvas. This is computed in virtual GetLayoutClip
    3. ClipToBounds – when true, sets clip rect equal to Rect(element.RenderSize). Defaults to false.

    All of these work independent and result clip is an intersection of all 3 sources."

    #1 and #3 are well known ...even I have touched on some (Clipping in particular) …

    the missing info is always #2.. LayoutClip?? What is that and where do I get me some? 

    Actually, what you need is to get rid of it.. You must override in your FrameworkElement GetLayoutClip () and return either a Geometry big enough for what you are doing, or return null (no clip) … 

    The downside  (in my thick headed opinion) is that to get around it, you will have to derive from and override GetLayoutClip ...  afaik, there is not a better way :(  

    So, let's give it a shot:  we create a Clipless button .. (UC= UnClipped )

    public class UCButton : Button
     {
      protected override Geometry GetLayoutClip ( Size ls )
      {
      return null;
      }
     }

    and update our xaml of course now cut & paste into EID or VS2005 since we have code-behind ...

    <Grid
     xmlns="
    http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="
    http://schemas.microsoft.com/winfx/2006/xaml"
     xmlns:mc="
    http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:d="
    http://schemas.microsoft.com/expression/interactivedesigner/2006"
     mc:Ignorable="d"
     Background="#FFFFFFFF"
     x:Name="DocumentRoot"
     x:Class="UntitledProject1.Scene1"
     Width="640" Height="480" ClipToBounds="False"
     xmlns:lcl="clr-namespace:UntitledProject1">

     <Grid.Resources>
      <Storyboard x:Key="OnLoaded" RepeatBehavior="5x" >
       <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(RotateTransform.Angle)" Storyboard.TargetName="Rectangle">
         <SplineDoubleKeyFrame d:KeyEase="Linear;Linear;0.5;0.5;0.5;0.5" KeySpline="0.5,0.5,0.5,0.5" Value="360" KeyTime="00:00:02.0" />    
       </DoubleAnimationUsingKeyFrames>
       
       <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(RotateTransform.Angle)" Storyboard.TargetName="Rectangle2">
        <SplineDoubleKeyFrame d:KeyEase="Linear;Linear;0.5;0.5;0.5;0.5" KeySpline="0.5,0.5,0.5,0.5" Value="360" KeyTime="00:00:02.0" />    
       </DoubleAnimationUsingKeyFrames>   
      </Storyboard>
     </Grid.Resources>

     <Grid.Triggers>
      <EventTrigger RoutedEvent="FrameworkElement.Loaded">
       <BeginStoryboard x:Name="OnLoaded_BeginStoryboard" Storyboard="{DynamicResource OnLoaded}"/>
      </EventTrigger>
     </Grid.Triggers>
     
     <Grid.ColumnDefinitions>
      <ColumnDefinition Width="0.20*"/>
      <ColumnDefinition Width="0.20*"/>
      <ColumnDefinition Width="0.58125*"/>
     </Grid.ColumnDefinitions>
     <Grid.RowDefinitions>
      <RowDefinition Height="0.12*"/>
      <RowDefinition Height="0.12*"/>
      <RowDefinition Height="0.76*"/>
     </Grid.RowDefinitions>
     <Button  HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,0,0,0" Width="120" Height="62" Grid.Row="1" Grid.Column="1" ClipToBounds="False" >
      <Rectangle Stroke="#FF000000" Fill="#FFFFFFFF" Width="90" Height="42" x:Name="Rectangle2" RenderTransformOrigin="0.5,0.5">
       <Rectangle.RenderTransform>
        <TransformGroup>
         <RotateTransform Angle="0"/>
        </TransformGroup>
       </Rectangle.RenderTransform>
      </Rectangle>
     </Button>
     
     <lcl:UCButton   HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,0,0,0" Width="120" Height="62" Grid.Row="1" Grid.Column="0" ClipToBounds="False" x:Name="Button" >
      <Rectangle Stroke="#FF000000" Fill="#FFFFFFFF" Width="90" Height="42" x:Name="Rectangle" RenderTransformOrigin="0.5,0.5">
       <Rectangle.RenderTransform>
        <TransformGroup>
          <RotateTransform Angle="0"/>
         </TransformGroup>
       </Rectangle.RenderTransform>
      </Rectangle>
     </lcl:UCButton>
    </Grid>

    Put it together and you will notice  the first button no longer clips: success:)    

    ----

    I have seen a few  folks doing this really cool "part1, part2" ....  I have not picked any thing deep enough to do that, but today I am still going to fake it ... cause I need to send a more specific answer.. Sam, stay tuned for part2 (20 min or so) ...

  • Jaime Rodriguez

    .NET FX 3.0 July CTP...

    • 0 Comments

    While I am here, might as well share a headache from last week...

    The .NET FX 3.0 July CTP shipped with out "cider" (aka VS Extensions for Orcas)...

    why would MS do that ?  Pretty simple: there were huge fixes for Card Space and WCF that needed to go out; so there was plans for the June Refresh

    At the same time, the Vista team was releasing a new build ( 5472.5, which rocks!! ) and Cider did not have time to sneak in a re-compile...

    OK, so  no Cider does that mean you should skip July CTP?  imho you could if you are *not* in one of these situations:

    • You need to run 5472.5 of vista, which ships w/ July CTP.. 
    • You are close to shipping a WPF app;  the WPF is tightening up significantly on their builds.. the bar for defects and DCRs is high; if your code is not working on July CTP and you have show stoppers, this is the time to report them; later, it is harder  (not that it is easy now, this boat is sailing) ...  For this scenario, I recommend a test machine where you mostly  compile via MSbuild and test..

    So, again if you are not in the two above, stick w/ june it is quite good..  If you are in the second one, use a test machine just to validate your progress but develop in June CTP.. the differences are mostly bug fixes..

    If you must ( and lots of you working with me are in this situation ) move to Vista,  then there is a unsupported workaroudn you can try..  I emphasize unsupported; which you can translate as "this is not recommended, you will get burned" ... 

    you can try to install the June CTP with the

    msiexec /i vsextwfx.msi WRC_INSTALLED_OVERRIDE=1

    This will let you install ... It works OK for the most part... I get intellisense and can create new projects (have all the WinFX templates)...  but  I had to disable Cider  ( so using XML editor for xaml) ..  and I do notice some issuses with the build system.. I end up having to do a "rebuild all" alot cause if I jusst build and all I had updated were xaml files, these changes are not being picked up .. .

    hth,

     

     

     

     

     

  • Jaime Rodriguez

    DataTemplates in WPF..

    • 2 Comments

    Today, I mentioned "DataTemplates" to a new team that is just getting started w/ WPF..  

    templates came into the conversation because they were asking about time estimation for developing a few screens; being a developer, I argued that the binding and basic layout was trivial and we mostly should be be concerned with designer's time to decorate the screens (because they had conceptual);  of course this landed in MO ( the "show me!"  state) ... and I dumbly said "surely there is lots of samples on data templates out there" ...

    Sadly, I was 1/2 way right..  There are lots of samples that use DataTemplates but none that explain it .. www.beacosta.com is by my favorite WPF data blog and she does have samples on the more advanced DataTemplate concepts ( e.g. DataTemplateSelector) ... but no intro..

    So, here is my attempt to get out of the hole I digged this morning .. with out reinventing the wheel...

    Straight from the "DataTemplates' overview on MSDN" ...

    Data templates are a natural extension of styling controls and elements provided in Windows Presentation Foundation. Just as you can apply a visual Style to a user interface (UI) element, you can apply a DataTemplate that can determine both visual aspects of how the data is presented and how data binding accesses the presented data. By applying different data templates to the same data, you can flexibly change the visual appearance of the data in your application. Data templates can be applied to both Windows Presentation Foundation content controls (for example: Button and Hyperlink) and items controls (for example: ListBox, ComboBox, and Menu). These controls have built-in support for applying such data templates.

    Next, from Bea's blog,we steal some assets...  and plug in the article you should read after thiss one .. http://www.beacosta.com/Archive/2005_11_01_bcosta_archive.html

    Here she has a master-details sample, which I think is perfect to explain data templates:

    We have a planet DataObject, and we use templates to represent it in two different ways: simple text in a listbox ( master ) and detailed view for the selected item in the listbox.  Two templates, same data item, two totally different views ...   It is that simple, I am going to bed.  Ok, here I will show you ..

    Downloaded beas' sample... but

    • it is PDC build,
    • used an inline XMLData provider -great for her sample, but I extracted it to prove there is no magic tricks in there, and most importantly
    • I wanted to do it using EID ...

    So I decided to only reuse the assets (images + xml data source) ...  

    Opened her project and extracted the solarSystemPlants XMLData Provider she had ... onto its own file ...  ( planets.xml in attachment) ...

    {Setup}

    1. Open EID -
    2. Create New project -
    3. Save Project As    {optional, but I like to do it}
    4. Project - >  Add Existing Item
    5. navigate to her sample and select all the images
    6. Project - > Add Exiting Item
    7. Navigage to our planets.xml file

    { The (drag & drop) work }

    1. On the Data Palette
      1. Add new Xml Data Source
      2. Click Browse
      3. Select planets.xml 
      4. Click OK
    2. Still on Data Palette
      1. Expand the tree, to see SolarSystemPlants and Planet[n]
      2. Move your mouse over the Planet[n] node
      3. While mouseOver on Planet[n] left click to drag & drop the planet[n]  into scene1.
      4. "Select a Control to represent this data field" should come up ...
      5. Select ListBox
      6. Under Create Data binding, Click OK this will create a oneway binding good enough for this ...
      7. Under Create Data Template,  Uncheck  Planet (which should uncheck all)
      8. Now Check @Name    [which again does tha planet, annoys me a little but we will live with it for now]
      9. Under the Name, enter "PlanetNameOnlyTemplate"
      10. Click OK
    3. In Scene1, now we have a listox item with each planet name populated..  this is the simplest view we can have ( winforms even creates that) ... stick around, we will improve on that ...
    4. From Library, drag a  Content Control into our Scene 1  ( make it relatively big, this is our detailss view )
    5. Right Click on the COntent control, select "Bind To Data"
    6. from Data Sources, select SolarSystemDS
    7. Under fields, expand SolarSystemsDS to Planet [n] and select it
    8. Click Define Data Template
    9. Notice the same screen we saw earlier for Creating a Data Template comes up. 
      1. This time we leave everything checked
      2. For Image property (in planet) , we change it from TextBlock to Image ...
      3. Click OK

    [We now have two Data Templates for the Planet XML element; one is a simple, name only view, and the other is the Detailed View]....

    in Step 7 above we told the data binding code that we were binding to a Planet; this is right, but we specifically want to bind to the planet selected in the listbox, so lets:

    1. Right Click on Content Control again
    2. Select Bind To Data
    3. Click Element Property
    4. Select the ListBox
    5. Under properties, find Selected Item...   and select it
    6. Click Finish
    7. Run it ...    Project -> Test Project ..

    he , i bet you are thinking I messed up  :)  cause all u see is the listbox, now Select a planet from the listbox ...  voila ...

    Zero lines of code... and we are wired... master details .. see how the datatemplates helped to create two different UI representations for planet   { yes, it is ugly, we still need the designer} 

    One last thing is still bothering me .. The listbox still looks simple... Let's spice it up... what we can do is reuse the details template inside the lisbox.... 

    1. In Scene1, Click XAML Code  [
      1. we have to do this to quickly get around what I think is an EID bug or an I/O error with me.. I need to check on later EID build]
    2. Find the line that says

                    <DataTemplate x:Key="PlanetTemplate">

    and change it into:

                   <DataTemplate DataType="Planet" >

    By doing this we are now telling the Data template that it can be used any where a template is needed for type Planet  (and a Key has not been specified)

    {sorry next should be #3, but this editor does not have 'continue numbering]

    1. Go back to Design view 

    2. Double Click on the ListBox

    3. In properties palette,

      1. select  "ItemTemplate"

      2. Right click, and select "Clear/Default" -- so we clear it from using the old "PlanetNameOnlyTemplate" ... we are not going to set it to any thing but WPF magically will know it is a Planet XML element and find the template for it ..

      3. Now test it, "Project Test Project" ...

      4. You should get a "Detailed view inside the Listbox" ..pretty neat, similar to how Healthcare demo shows the Patients in the listbox...   those are styled our little sample is not ..

    That is it ... You have now seen the power of templates..  No lines of code,  under 15 mins, a nice detailed view inside a listbox ....  The designer can now decorate the template nicely.. and be done with it..

    The project with the solution is attached...  [create in July CTP under Windows Vista]

    You should now go back to www.beacosta.com and read about DataTemplateSelector and some deeper datatemplate topics ... 

    [ I will be back later this week w/ more advanced/ interesting posts, this one at least brought me back into the blog]

     

     

     

     

     

     

     

     

     

     

     

     

  • Jaime Rodriguez

    rounded corner images in wpf.

    • 0 Comments

    this has come up 3 times over last few weeks.. so I am putting it here for the nxt time .. 

    "How do I create a mask to round the corners of an image" is how it gets worded, which of course scares me due to history with OpacityMask --in earlier builds, and I think still in beta2- OpacityMasks forced software rendering. no worries it is fixed in later builds..

    Here are two alternatives besides OpacityMask...  [now that OpacityMask is hardware accelerated it is also not a huge deal to use it, but not discussing it here cause the SDK does a great job at it..

    Option 1:  (recommended, most performant)

    Draw a Rectangle with Rounded Corners and Fill it with the ImageBrush ... 

    In EID,

    1. Project - > Add Existing Item -  to add your image
    2. Drag the image from Projects Window to Scene
    3. Select Image, Go Tools - > Make Tile Brush -> Make Image Brush
    4. Now you can drag the radius of the rectangle and make it round

    Voila!

    That is good, how ever it mostly works for images...   Another way that works for any UIElement that you want to "contain" is:  

    Option 2: Create a Clipping Path..

    1. Double click on Image in project window to add to scene
    2. Add a rectangle or any other shape to your scene.. position it right on top of the image you want to clip
    3. drag the radius of the rectangle to be of the shape you need the image
    4. Select the Rectangle First -- Note: order matters here
    5. Press Ctrl  and select the Image you added to scene in step1
    6. Select Tools - > Make Clipping Path

    Voila!

    Option 3:  OpacityMask is well documented in the SDK .. so we won't repeat it here..

    When to use which -- some of the criteria I have seen so far was:

    • Performance -- when will do it many, many times
    • Dynamic layout, cause don't know what the image looks like
    • Ability to manipulate/apply transforms to the Image/Brush .. Say to create a "Zoom effect into the image but with out resizing the image frame"  ..

    On performance, differences should not be too noticeable unless you do it 100s of times ... but if you do it many times (e.g. image catalog) it will add-up... so should be considered..

    Rectangle/Image Brush <    Clipping <  Opacity  Mask    for how expensive it will be.

    On Dynamic Resizing (different size images) ,  I find rectangle to be easiest ...

     <Rectangle RadiusX="50" RadiusY="50"

    Width="{Binding ElementName=brush,Path=ImageSource.Width}" 
     Height="{Binding ElementName=brush,Path=ImageSource.Height}">
        <Rectangle.Fill>
          <ImageBrush x:Name="brush" ImageSource="f:\users\jaimer\pictures\untitled.png"/>
        </Rectangle.Fill>
      </Rectangle>

    In EID,

    1. Go to XAML view and add a x:Name for the brush
    2. Find Width in properties Window ...
    3. Right Click on Width,  Select Databind
    4. Select Explicit Data Context
    5. Check "use a Custom Path expression"
    6. Enter 'ElementName=brush,Path=ImageSource.Width'  (minus the quotes)
    7. Repeat 2-6 for Height

    For resizable Clipping Path I did it in code .. cause I was lazy about thinking too much about it..

    In EID,

    1. Go to Timeline
    2. Select your image
    3. Go to events Window
    4. Click Add, 
    5. Select SizeChanged , enter OnSizeChanged for the event name.
    6. In the code window, add these two lines

    Add

    private void OnSizeChanged(object sender, System.Windows.SizeChangedEventArgs e)
      {
        System.Windows.Rect r = new System.Windows.Rect( e.NewSize );
                  RectangleGeometry gm = new RectangleGeometry(r, 40, 40); // 40 is radius here
                  ((UIElement)sender).Clip = gm ; 

      }

    On Animations/Transforms  in EID ..

    • Clipping scenario is straight forward..  No issues.
    • With VisualBrush, EID appears to not let you create Storyboards for animations..  bummer! here is how you can get around it.. 
      • Create a scene and drop the Image (not the brush ) into the scene ..
      • Create all the animations/storyboards against the image..
      • Once you have created all the storyboards, you can create the brush..
      • Give it the same x:Name you had given to the Image and then replace the Target Properties, from  UIElement.RenderTransform to ImageBrush.Transform  .. assuming those are the parts you animated..

    That is it .. You now have rounded images.. that will perform well and look neat!

     

     

     

     

     

     

     

     

       

  • Jaime Rodriguez

    CLR profiler in Windows Vista beta2 ...

    • 0 Comments

    for some reason my CLR profiler was misbehaving in Windows Vista beta2..  CLR Profiler started fine but I was getting "waiting for application to start" and it just would not sync..  ( I waited 15 minutes twice :(

    Tried the "Run As Administrator"  and it all worked fine..   from there on seems better..  Not sure what is up, but thought I would share the workaround just in case ..

     

    UPDATE:  Yes, the CLR Perf team confirmed that CLRProfiler tries to register  ProfilerOBJ.dll  the first time it runs..Due to UAC this was failing ..  so, if you run into issues just register the dll manualy...  [yes, you will need admin for it] ...

     

  • Jaime Rodriguez

    video driver checks for hardware acceleration iin WPF beta2

    • 0 Comments

    The way to know if you are getting HW acceleration is still Perforator .. [that ships w/ the WinFX SDK] ..  If you are not getting acceleration, check SeemaR details on the 'driver checks' in WPF to decide if you need to upgrade drivers

    Please provide feedback on your driver experience .. It is good to know for RTM ..

    -j

     

  • Jaime Rodriguez

    Adobe Fireworks to XAML exporter...

    • 0 Comments
    via Mike Swanson's ... blog
  • Jaime Rodriguez

    Executing against the Windows Presentation Foundation vision .. [Update as of beta2]

    • 0 Comments

    When we started looking for early adopters, it was all about business value; I had three specific scenarios:

    • enabling NEW capabilities,
    • accomplishing more with less effort -in particular designer/developer workflow-, and
    • reaching/touching end users in new ways that created new business opportunities (improved UX)


    So far, we are executing extremely well against two out of three: new capabilities, and improved UX.. I weekly talk to developers and designers that tell me "WPF really allows us to do things we could not do before because it was not cost effective"..    The ROI has not been measured yet, but based on feedback, I think we are in great track..  

    The third one is worth discussing a bit more: accomplishing more with less effort ..  

    I must digress to share MY expectations around this: the long term goal is to have interactive designers prototype functional/interactive applications with out writing code -- from what I hear from customers that were using Flash, Flex, Windows Forms, etc. this was already quite a goal. Most interactive designers are not afraid to code a tiny bit..    
    Graphics designers, on the other side should not be expected to code (now or later).. this is a topic I leave for a different day; be aware of the roles because  the game is changing; we need not use the term designer as broad as we did before.

    How far from that itneractive designer Nirvana are we?
    What I see is that with WPF you definitely accomplish more; the range of technologies to integrate is wider and enables many more possibilities.
    I also see that designers and developers are (imho) for the first time ever collaborating in the same files via XAML ...  This is definitely an improvement from how things were done before, but there is some thing preventing us TODAY from being just GREAT in this scenario: The tools are not done and the designers often have to get around small issues. Long term, this is not a concern at all; we should get from good to great soon in a matter of months ...

    Does this means you should not start today??  I don't think so, the business value is there.  I think there is just a few things that you should be aware of: how to use resources, when and how to use templates, styles,  etc..  and most importantly, be prepared to do a little cut & paste today on tasks that will be seamlessly implemented by the designer tools in a few months.. 


    What about developers?
    The run-time is solid; you don't have to worry too much about there being lame bugs that you have to chase for hours before confirming is a bug..
    you also do not need to worry about whether starting now will cause you to re-write later ( as we did going across CTPs in the past); the churn on the OM is pretty minimum now a days.

    I am sure you read some where that the developer tools are further behind. This is true, but there are other good news on that front: Expression is fairly easy to use for developers, concepts like projects, designers, properties windows, etc, is what we are in used to, so it is easy to use; it does lack the debugger, and rich editor from Visual Studio, but so far my work around is to open the same project in Expression and VS at the same time .. I debug on one, and design on the other .. Works pretty well for me ..  it even makes me be more conscious of separation between UI and business logic..


    Scorecard for the 3 goals.. Two we are definitely at 100%, the third one I would say we are at 60% with the potential to make it to 85 in a few months...  I say that is pretty good specially if you consider that the current 60% is probably better than the way we did dev/designer workflow in the past - where a designer handed  an image created in Visio, Photoshop, or any other similar bitmap tool...  and the developer had to reinterpret and recreate it all using the dev tools [leading to an endless cycle that compromised design and lead us to the 'good enough/out of time' apps ...


    Two Disclaimers on statements above:
    I speak based on my experiences in last few months with a dozen orso enterprise customers..  Your scenario might be different, but if you have concerns drop me a line. 

    Also, I did not dive into 3rd party tools like Mobiform's aurora and/or Electric Rain's Zam3d.. Adobe Illustrator plug-in, etc.  I will get to these a different time..


     [darn it I need a better editor for this ... will ask my fellow bloggers]

  • Jaime Rodriguez

    Notes/Interpretations from the field...

    • 0 Comments

    WPF evangelism has been a lot of fun lately..  many companies are popping up wanting to build the next gen UX on WPF ... (e.g. this EMAP demo, coded in record 2 weeks time-frame and with out any help from Redmond -that I am aware of)... 

    My enterprise projects are definitely shaping up ..  Most of them are designed and some are well into development..  None of mine are in production yet ..  but ibloks and the northface are ... and you can see some of the progress in our apps from the new www.seewindowsvista.com (OTTO and TSRI are enterprise projects)... 

    With this progress in mind, and an eminent close down towards RTM, it is time to start sharing some of MY opinions on lessons learned/workarounds, etc..

    I can't do all of them in the 30 mins I have now, but here are some topics I will flesh out soon: 

    • How are projects excuting against the WPF vision/goals
    • How to start/Ramp-up  to WPF
    • Architecture in wpf and why is it so cool ... 
    •  Is WPF for Enterprise LOB apps?
    • Databinding  -- this one just cause its fun 
    •  Hardware acceleration
    • Virtualization
    • 3D in WPD 
    •  Video in WPF  
    •  Mobility  ...  (note I am not talking about WPF/E,  I am talking about laptops and WPF )
    • Media Center
    • Performance  ..
    • Tools 

    If I missed the one you are interested, email and let me know ...  I am not sure I will go in the order listed above, help prioritize if you please..

    Also, if you have a different WPF app going live in beta2, let us know..

  • Jaime Rodriguez

    catch up blogs..

    • 1 Comments

    last two months I read no blogs -- this had to do with my moving 100% to Vista & office beta2, I read blogs from an add-in that undestandably did not work in Outlook - to be fair Idid not research/not report it..   But just now, got all my blogs caught up.. Great stuf...

    here are my favorites -- sorry I did not keep track of who it came from --

    StoryBoard.DesiredFrameRate - Every one should know about it already.. but just in case.. Use it if you can :)

    WPF/E in channel9   The WPF/E team is moving at warp speed ..

    The WPF Blog  -- Subscribed -- for those historically flash designers that deal with me daily ... see, I am trying to learn more about flash, so we can communicate easier ..

    WPFSDK team blog  -- Subscribed! lotsa great samples.. 

    ScreenSpaceLines3D --  I missed it while it was gone!

    The End.. Lots of other great stuff I am sure I missed.. 

     

     

     

     

     

     

     

     

  • Jaime Rodriguez

    Windows Presentation Foundation Beta2 ...

    • 1 Comments

    Is out the door ... For breaking changes and "what's new" information, check Tim Sneaths post

    If you run into a change that is missing let us know..

     

     

  • Jaime Rodriguez

    back online..

    • 0 Comments

    wow.. almost two months.. here is the short excuse: 

    My baby girl was born 7 weeks ago.. so I took 3 weeks off..  since I got back, it has been way too busy ...  [will share updates on that soon] ..

    but today, all the beta2 products shipped so I had to share a link  ...

     

  • Jaime Rodriguez

    The "UI framework" team is alive and teasing ...

    • 0 Comments

    In the last 3 days  I have gotten 4 emails about this blog entry..  That is pretty unusual ...but  the blog excites me cause Acropolis is out to the public...  Their vision is very cool and I think it will fill a much needed hole ...

    The blog is particularly bogus (or high level) with regards to Acropolis, so I won't leak any thing before checking with them, I know the paint still fresh on their planning...   All I will share is that Acropolis is lead by David Hill, the person who architected the Composite Apps for Dell well before the Patterms team turned that work into CAB ... 

    My advise, subscribe to the UI Framework blog; ping Richard and demand the details :) .   and Check David hill's blog  in case he decides to share..       

     

  • Jaime Rodriguez

    XPS Essential Pack.. beta1

    • 0 Comments

    Recently, I had a few issues printing a large XPS document...

    I reported it internally and today  I got a link to this newly posted XPS viewer..   It still has a few issues ... but so far looks like a neat WPF app and my printing problems are gone :)

      http://www.microsoft.com/whdc/xps/viewxps.mspx 

  • Jaime Rodriguez

    Windows Presentation Foundation Everywhere ( WPF/E ) at MIX06

    • 0 Comments

    WPF/E is a cross-platform (POR is windows + mac, linux tbd) subset of WPF that runs in a browser..

    At MIX Joe Stegman ( presented the most comprehensive overview and release plans I have seen to date) ... Mike Harsh has posted Joe's presentation here and is keeping track of the post-mix06 buzz.... My favorite so far is at http://ajaxian.com/archives/microsofts-mix-06-conference  ...

    if you are interested in WPF/E ... please check on Mike's and Joe's blog.. I just subscribed ;)

    Also, I hear the MIX sessions will be posted in a few weeks..  Not sure where or when but I am guessing if you monitor the MIX blog, you will find out sooner than the rest of us ..

     

     

  • Jaime Rodriguez

    New Expression training videos...

    • 1 Comments

    Last week, the expression team posted five new "training" videos for expression ...

    You can find  them here

    http://www.microsoft.com/products/expression/en/demos.mspx. Simply click the Interactive Designer tab near the bottom of the page, and then click one of the video links under Training Videos.  

    [Disclaimer: I just saw the first 3 of them .. and ended up w/ mixed feelings.. overall the videos were helpful for EID newbies ... but I found them a little marketting heavy.]

    If you are looking for EID videos, give these a shot .. let us know if you like them; the expression team's blog is at http://blogs.msdn.com/expression/  ... If they have comments disabled, feel free to send them to me directly  and I will pass them along..

     

     

  • Jaime Rodriguez

    A Windows Forms/WPF hybrid satellite assembly.

    • 0 Comments

    This is an FAQ ... 

    For those with Windows forms apps and moving to WPF apps..  reuse of existing windows forms localized strings is a must in order to save  time & money..

    Mike henderlight  gives you the recipe step by step  http://blogs.msdn.com/mhendersblog/archive/2006/03/30/565040.aspx

     

    [while there check all the other posts on crossbow..   It is amazing to me why there is little noise around crossbow.. Is i that it works and nobody needs help, or is it that nobody cares..  Either way you should let Mike know ..

  • Jaime Rodriguez

    What is XAML??

    • 0 Comments

    I get this a lot, and usually answer "xaml is an xml based object initialization language" .. technically that is correct... but ChuckJ has a more complete answer here on this must read.. 

     http://www.removingalldoubt.com/CategoryView.aspx/XAML 

  • Jaime Rodriguez

    Getting started with Windows Presentation Foundation (Avalon)

    • 0 Comments

    There are lots of blogs out there on learning windows presentation foundation ... 

    Tim Sneath First Steps to WPF  is praised quite a bit..    but I am more of a video/training person  so I like Filipe's list of all PDC videos ..  Unfortunately, that takes 15 hours..  A more concise list is Pablo's reccomendation   If all you have is one hour, then my personal favorite is Rob Relyea's lap around avalon  ..

    Don't forget Chris Sells and Ian Griffiths have a good book out there.. The book was written w/ PDC bits (or so) but most concepts still apply and they tend to keep the samples up-to-date with the current CTP .

    If none of these help, drop me a note with your specific need and I can try to point you in the right direction..

  • Jaime Rodriguez

    welcome... and what you can expect

    • 0 Comments

    I tried blogging once before.. it is hard work, takes discipline and having some thing smart to say ..  These are three adjectives I normally do not associate with myself..  so I will warn that I am likely not going to be a good blog-izen ..   

    If you want to know what you will find here, is for the most part references and maybe announcements..   I am not sure yet... 

    Why do it then?  I am an evangelist at Microsoft, helping with early adoption of WinFx and Vista..   I deal with a lot of partners/customers with whom I need to communicate... so I intend to blog some of those faqs such that I can point them here..  If any one else finds it useful,  well that is neat too..

    I do read a lot of blogs.. if you are writing or doing stuff with Windows Presentation Foundation, drop me a link to your blog .. I am always eager to read how people use MS technologies to solve business problems.. 

    Cheers,

     

Page 9 of 9 (222 items) «56789