Silverlight 2, RC available

image

Via ScottGu, the Silverlight 2 Release Candidate is now available for download.

Low-lights:

  • No new go-live license for until the final version is released (the RC Silverlight binaries won’t be made available to the general public)
  • It has some breaking changes for code (details here).
  • No RTF control (one can dream … :))

 

High-lights:

  • The layout system in Silverlight has been modified to round final measure and arrange values to integers when placing elements on the screen (“pixel snapping”). The result is crisper lines, more consistent rendering look, and fewer rendering artifacts.
    Layout rounding will be *on* by default, but there is a new inherited property on UIElement called UseLayoutRounding that can be set to false if the old layout behavior is desired.
    Note   It is possible that this change will affect how your animations render, in which case you might want to set UseLayoutRounding to false.
    Note   This change does not affect transforms. If you apply a transform to an element, it may still be rendered at a sub-pixel location.

    🙂 What this means is that the fuzzy anti-aliased look of the old version should finally be gone — and instead you’ll get crisper text/lines/everything without resorting to pixel snapping transform hacks.

  • Combo-box
  • Password text box
  • Better looking default skins.

The big question — will it get the adoption rate needed by web companies and ISVs in order to make it a viable platform? (I wonder if it will be installed by default on a Windows 7 box?)

Flash 10 and the associated tools look really good … Blend (and Silverlight) is years behind. I love the new simple 3D features of Flash CS4 Professional.

Data Binding and Tooltips in Silverlight

Have you ever wanted to databind a tooltip in Silverlight (or WPF for that matter), and found that the DataContext isn’t available for tooltips (the datacontext is null)? It’s very annoying. Tooltips, unfortunately, aren’t connected to their parents in anyway when they’re created, so they loose the ability to connect to the proper data context that is being provided to their parent. Listboxes, textboxes, all suffer from this problem.

In order to combat that problem, I’ve come up with a simple workaround for this data context problem.

I’ve created a simple attached property which augments the standard tooltip property and intervenes before it is created so that the proper data context can be established. This code hasn’t been tested thoroughly, but it works in my limited testing. It could be extended to handle more edge cases, but if you’re creating advanced tooltips outside of XAML, there’s little reason to use this code.

public class DataBindingTooltip {
     public static DependencyProperty TooltipProperty;

     static DataBindingTooltip()
     {
         TooltipProperty = DependencyProperty.RegisterAttached
             ("Tooltip", typeof(object), 
             typeof(DataBindingTooltip), 
             new PropertyMetadata(TooltipChanged));
     }

     public static void SetTooltip(DependencyObject d, object value)
     {
         d.SetValue(DataBindingTooltip.TooltipProperty, value);
     }

     public static object GetToolTip(DependencyObject d)
     {
         return d.GetValue(DataBindingTooltip.TooltipProperty);
     }

     private static void TooltipChanged(DependencyObject sender, 
         DependencyPropertyChangedEventArgs e)
     {
         if (sender is FrameworkElement)
         {
             FrameworkElement owner = sender as FrameworkElement;
             // wait for it to be in the visual tree so that // context can be established owner.Loaded += new RoutedEventHandler(owner_Loaded);
         }

     }

     static void owner_Loaded(object sender, RoutedEventArgs e)
     {
         if (sender is FrameworkElement)
         {
             FrameworkElement owner = sender as FrameworkElement;
             // remove the event handler owner.Loaded -= new RoutedEventHandler(owner_Loaded);

             DependencyObject tooltip = 
                 owner.GetValue(DataBindingTooltip.TooltipProperty) as DependencyObject;
             if (tooltip != null)
             {
                 // assign the data context of the current owner control to the tooltip's datacontext tooltip.SetValue(FrameworkElement.DataContextProperty, 
                     owner.GetValue(FrameworkElement.DataContextProperty));
             }
             ToolTipService.SetToolTip(owner, tooltip);
         }            
     }
 }

 

Here’s how to use it:

<Grid x:Name="LayoutRoot" Background="White"> <ListBox x:Name="lb" ItemsSource="{Binding Mode=OneWay}"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <local:DataBindingTooltip.Tooltip> <StackPanel Orientation="Vertical" > <TextBlock Text="Tooltip!" FontWeight="Bold" /> <TextBlock Text="{Binding Name}" /> <TextBlock Text="{Binding Age}" /> </StackPanel> </local:DataBindingTooltip.Tooltip> <TextBlock Text="{Binding Name}" Margin="4" /> <TextBlock Text="{Binding Age}" Margin="4"/> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> </Grid>

 

And, a small test sample:

public partial class Page : UserControl {
    public Page()
    {
        InitializeComponent();

        lb.DataContext = new List<Person>() { 
            new Person(){Name="John", Age=23},
            new Person(){Name="Hank", Age=37},
            new Person(){Name="Sally", Age=31}};
    }
}

public class Person {
    public string Name { get; set; }
    public int Age { get; set; }
}

Which, when you put it all together results in:

image

Hopefully, you can spot the trick — as soon as the host control has been created and assigned a datacontext (in the Loaded event for the element), I set the datacontext onto the tooltip and assign it to the REAL tooltip property (via the TooltipService.Tooltip attached property).

Hope you find this useful.

Gulp – a WPF-based text editor for Visual Studio 10?

According to this, the next version of Visual Studio (v2008 + 1), will have an editor written using WPF.

VS10: new WPF-based text editor w/ fine-grained extensibility, Microsoft Extensibility Framework (MEF, a.k.a. COM for managed code), new features support multiple languages

A very common scenario where I work is to use Remote Desktop for code editing, so if the code editor and shell is WPF — I’m very worried about the desktop remoting scenarios.

What’s your thoughts? Do you want your development tool to be the real first “giant” application produced by Microsoft using WPF? It certainly makes sense for many areas (like visualizations) – but ….

SharePoint as an Operating System?

Via Designing for Dot Net, Don shows a few screen shots from some educational application written in WPF designed by “the UK educational team” (I’m not sure what that is). He mentions SharePoint several times, but I don’t see what SharePoint has to do with the application. It’s worth taking a look at his blog post to see the screen shots of the application. The source link that he provides requires registration to read the full content – I didn’t want to register to get more details.

What freaked me out most wasn’t the application or the mention of SharePoint. It was the comment at the end about him agreeing with the suggestion that SharePoint is the next big “operating system” from Microsoft.

That got me to Google in a flash. Not so amazingly, I found the reference right away from the industry pundit Mary-Jo Foley here. Mary says…

I think they’re asking the wrong question. Instead, why not ask whether Windows will be the center of Microsoft’s universe going forward? Might there some other product/products upon which Microsoft is betting the farm?

She goes on to say…

SharePoint Server is the answer. Not Windows. Not Windows Server. Not Office. SharePoint.

Ballmer told the Convergence questioner he was dead-on in his thinking.

“SharePoint is the definitive OS or platform for the middle tier,” Ballmer explained. It is the “missing link” (my words, not his) between personal productivity and line-of-business applications.

OK, Steve, it is a platform. Microsoft is betting big on it. Can it become the definitive development platform for Microsoft? This software architect and developer certainly hopes NOT. SharePoint may be good for some enterprises. However, the user experience, the IT experience, and the current licensing models (server + client access licenses for all users) make any massive adoption unlikely. The licensing however can’t change much — otherwise there’s little point in betting big on SharePoint unless they can continue to make a significant amount of revenue from the platform in some other way.

image

image

I’m continually amazed by the number of ISVs founded entirely on the SharePoint platform. It’s amazing the traction it has gotten to date. I think the overall market is too large and too open for it to become the giant that is Exchange Server today. Microsoft needs ISVs to add value to SharePoint as Microsoft is only developing a platform.

Microsoft can’t bet everything on SharePoint. The company is too big for that. It can’t “be” the operating system (unless it starts to include a lot of extra moving parts stolen from Windows Server and SQL Server).

Regarding usability — a few interesting comments from NickMalik in his post “Ahead of the curve… again” if you can get beyond the nearly sickening “pro-SharePoint commentary in his original post. “The product is unstoppable.

What do you like/dislike about SharePoint? What do you use instead of SharePoint?