Alive and kickin’ [New Silverlight 4 Toolkit released with today’s Silverlight 4 RTW!]


This blog has moved to a new location and comments have been disabled.

All old posts, new posts, and comments can be found on The blog of dlaa.me.

See you there!

Comments (42)
  1. cplotts says:

    Congrats on another release! Can’t wait for the next developer release (including these bits) to show up!

  2. TedHoward says:

    "ApplicationThemeUri is a simple bool value" should be "IsApplicationTheme is a simple bool value"

    And thanks for the great toolkit.

  3. David Anson says:

    TedHoward,

    Oops, thanks for catching that! I’ll be updating this post soon to include the final links of the stacked series and ContextMenu follow-ups and will correct that mistake then.

    Thanks very much for pointing this out!

  4. vsi says:

    Are you planning to make source code of System.Windows.Controls.Toolkit.Internals.dll available anytime soon? Some really great stuff like AnonymousObserver, ObservableExtensions, etc that used to be available in toolkit’s sources has been moved there and left internal. What a cruelty.

  5. Staxmanade says:

    Any chance a signed version of the new Testing Framework could be put together as a "last official" release for Silverlight 3.0?

  6. David Anson says:

    vsi,

    As I explain in the post above, System.Windows.Controls.Toolkit.Internals.dll is the Toolkit’s stand-in replacement for the official Reactive (Rx) assemblies – which are still available from the Rx team from the link I provide above. The source code for the Rx assemblies was never part of the Toolkit, so Toolkit users should be no worse off for this change. And, as I explain above, they should actually be *better* off by virtue of the additional freedom with regard to Rx versioning.

  7. David Anson says:

    Staxmanade,

    There’s no plan to do another Silverlight 3 Toolkit because Silverlight 4 is now available to everyone. Updated versions of the Unit Testing Framework for Silverlight 3 and Windows Phone 7 should be available from Jeff soon (via the link I give above). Is there a reason you’d need a signed version?

  8. gagglefish says:

    Any chance of getting an example of changing  themes for an entire application dynamically at runtime?

  9. vsi says:

    Delay, thanks for replying… though honestly, I fail to understand how users are going to be better off after a lot of useful helper functions and classes that have been part of the *toolkit* (not rx libraries) and that are still used all over toolkit have been made unavailable for the rest of the world. What is the point of including something into Rx assembly that is used exclusively by toolkit?

  10. David Anson says:

    gagglefish,

    I’ve added it to my TODO list. 🙂

  11. David Anson says:

    vsi,

    You’re right that there were isolated cases where Toolkit code needed to be made internal because it referenced the internal Rx replacement assembly.

    That’s the case for the Toolkit’s implementation of ObservableExtensions (note that there’s a same-named implementation of this class in Rx). You can still find the source for the Toolkit’s version of this file (and any others) in the Silverlight 3 branch of the public source code:

    http://silverlight.codeplex.com/sourcecontrol/network/Show?projectName=Silverlight&changeSetId=47051#752260

    AnonymousObserver looks to have been an internal Rx class (System.Reactive) all along, though I may be mistaken since I wasn’t intimately involved in all of the Rx work.

    I’m sorry about any inconvenience here! Though please understand there was strong customer demand for us to make this change and we’ve done it in as minimally impactful a manner as we could.

    Thanks for your understanding!

  12. jsp3536 says:

    ThemeUri can be changed dynamically by applications that allow users to change their themes "on the fly". Can ApplicationThemeUri be changed in the same way?  When I try to change it I get an error.

  13. David Anson says:

    jsp3536,

    I’ve just re-verified that my test application for changing ApplicationThemeUri at runtime works correctly. My scenario starts with that property set in App.xaml (to ShinyRed), then in a Button’s Click handler I call Theme.SetApplicationThemeUri(Application.Current, new Uri("…")) (to ShinyBlue) and the theme switches dynamically.

    If you’re still having trouble with this, go ahead and contact me directly (via the "Email" link) and we’ll troubleshoot.

    Alternatively, if you’re not in a rush, I’ve already got a note on my TODO list to write a sample for this and hope to get to that soon.

  14. jsp3536 says:

    Thanks for getting back with me. I will try it again.  I did have another problem. I noticed in my project when I had merged resource dictionaries in the app.xaml that the toolkit:Theme.ApplicationThemeUri set in the app.xaml would not apply the theme to my other xaml pages.  If I removed the merged dictionaries from the app.xaml then it would work.  The way I got it to work was to set the Theme.ApplicationThemeUri in the app.cs and I was able to keep my merged dictionaries in the app.xaml.

  15. Staxmanade says:

    Hello,

    I’m the founder of the open source project StatLight. (Statlight.codeplex.com)

    I’d appreciate a signed version of the a Silverlight 3.0 toolkit testing library because of the hard reference my open source project takes on the Microsoft.Silverlight.Testing assembly.

    I’d also like to have one final release for the 3.0 runtime that my project could host as the performance benefits would be much appreciated.

    Hope this helps.

    Thanks

  16. David Anson says:

    jsp3536,

    That seems odd… I’ll try to have a look into the behavior you’re seeing when I get a chance to do the targeted sample. But for now, it’s great to hear you’ve got a workaround!

    Thanks for following up!

  17. David Anson says:

    Staxmanade,

    Have you considered upgrading your project to Silverlight 4 now that it’s available to everyone (and completely backward compatible)? If you do that, it sounds like you can switch to the latest Silverlight 4 Toolkit and have everything you need, right?

  18. Staxmanade says:

    Originally I wanted to put out one final S.L. 3.0 release of StatLight, but now that I think about it, you’re right. I shouldn’t need to do that, as everyone out there should be upgraded to 4.0…

    Guess I have some work to do 🙂

    Thanks for your quick replys.

  19. laferrij says:

    Any idea why the drag events do not fire with the drag and drop.  IS there a worK around?

  20. David Anson says:

    laferrij,

    Sorry, I’m afraid I don’t understand the question. Have you tried asking on the Silverlight Forums?

    http://forums.silverlight.net/

  21. robsonfelix says:

    I have a custom UserControl that derives from another UserControl , which in turn derives from ContentControl. Everything on my control works fine BUT the new ContextMenu. I receive the following message when running the app:

    The attachable property ‘ContextMenu’ was not found in type ‘ContextMenuService’.

    I have tried to attach the context menu to every single object of my user control without success.

    Any clues?

  22. David Anson says:

    robsonfelix,

    Starting with VS 2010 and the April 2010 Silverlight 4 Toolkit, I created a new Silverlight Application project, added a reference to System.Windows.Controls.Input.Toolkit (which automatically pulls along a reference to System.Windows.Controls) and added the relevant XMLNS and XAML seen below to MainPage.xaml. That’s all and it worked fine for me – could you please try what I’ve done?

    <UserControl x:Class="SilverlightApplication3.MainPage"

       xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;

       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml&quot;

       xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit&quot;

       xmlns:d="http://schemas.microsoft.com/expression/blend/2008&quot;

       xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006&quot;

       mc:Ignorable="d"

       d:DesignHeight="300" d:DesignWidth="400">

       <toolkit:ContextMenuService.ContextMenu>

           <toolkit:ContextMenu>

               <toolkit:MenuItem Header="Sample MenuItem"/>

           </toolkit:ContextMenu>

       </toolkit:ContextMenuService.ContextMenu>

       <Grid x:Name="LayoutRoot" Background="White">

       </Grid>

    </UserControl>

  23. Ali110 says:

    Hi,

    Thanks for this useful post.

    I have a problem with ContextMenu. In my case MenuItems of context menu generates at run time .I am confused where to add my Command/EventToCommand of my MenuItems because I added EventTrigger to the root element of ItemTemplate which was a grid but the no event get fired. and this is true when I add EventTrigger to the Template of the Style and it does not work either.

    <toolkit:ContextMenuService.ContextMenu>

                   <toolkit:ContextMenu ItemsSource="{Binding FeaturesList}" ItemTemplate="{StaticResource DataTemplate_ContextMenu}" Style="{StaticResource ContextMenuStyle}" >

                   </toolkit:ContextMenu>

    </toolkit:ContextMenuService.ContextMenu>

    I clarify my question. When the MenuItems of a context menu generates at run time where can I define(in XAML) the command of MenuItems or MouseLeftButtonDown event of the MenuItems?

    Btw, Why Blend 4.0 RC does not show the ContextMenu Control in the element tree? This makes making Styling/Template harder.

    Thanks in advanced!

  24. David Anson says:

    Ali110,

    When MenuItems are generated automatically as in your example, you can customize the MenuItem containers by providing a Style with a TargetType of MenuItem for the ItemContainerStyle property of the ContextMenu. This is the same as how things work for other ItemsControl-based classes like ListBox/ListBoxItem and TreeView/TreeViewItem.

    If you’re going to use a Binding for one of the Setters (as it seems you will for setting the Command property), you’re probably going to need to use my SetterValueBindingHelper class. You can read more about that and see some Silverlight-based examples here:

    http://blogs.msdn.com/delay/archive/2009/11/02/as-the-platform-evolves-so-do-the-workarounds-better-settervaluebindinghelper-makes-silverlight-setters-better-er.aspx

    By the way, attaching to the Click event of the MenuItem is probably better than using its MouseLeftButtonDown event – but Command is more flexible than either. 🙂

    Hope this helps!

  25. ozba says:

    Hi, I’m using your silverlight default style browser and there is no StackedBarSeries style even when I added the System.Windows.Controls.DataVisualization.Toolkit.dll

    Do you know why? Is there no Default style for the StackedBarSeries?

    Thanks

  26. Ali110 says:

    Hi David,

    Thanks you so much for the response. The SetterValueBindingHelper class is awesome. There is an issue I have, I do not know why my Command does not execute. I added the following code to the ItemContainerStyle of my ContextMenu

    <Setter Property="helpers:SetterValueBindingHelper.PropertyBinding">

    <Setter.Value>

                <helpers:SetterValueBindingHelper>

              <helpers:SetterValueBindingHelper Type="MenuItem" Property="Command" Binding="{Binding ActiveFeatureCommand}"/>

             <helpers:SetterValueBindingHelper Type="MenuItem" Property="CommandParameter" Binding="{Binding FeatureName}"/>

    </helpers:SetterValueBindingHelper>

                   </Setter.Value>

    </Setter>

    I also uploaded the whole code on

    http://cid-2dfae0f19a7c2f5f.skydrive.live.com/self.aspx/Share/Silverlight/SilverlightApplication1.zip

    In the case you want to check.

    Thanks again.

    Ali

  27. David Anson says:

    ozba,

    If a class doesn’t set its DefaultStyleKey property to customize its default Style, then it uses the same default Style as its base class. In this case, the relevant base class is DefinitionSeries and the default Style for that class shows up in SilverlightDefaultStyleBrowser as you expect.

    I’m not sure there’s a lot in there you’d *want* to customize, but the scenario should work just fine if you do. 🙂

  28. David Anson says:

    Ali110,

    The DataContext of each of your MenuItems is an instance of the Feature class (because that’s what’s in FeaturesList which is the ContextMenu’s ItemsSource). The Feature class does not expose a property named ActiveFeatureCommand (that’s currently defined on the MainViewModel class), so the Command Binding you’re trying to set up aren’t finding anything to bind to. If you move ActiveFeatureCommand to the Feature class, things will work as you expect.

  29. Ali110 says:

    David,

    Thanks a lot for the help. It worked. 🙂

    Really appreciate it.

  30. dextro says:

    Thanks for the info!!!  I was looking everywhere for how to dynamically change a theme.  

  31. Ashok N says:

    Hi,

    Can you please tell me to chage the themes in SL4 dynamically through code. I have gone through all your above explenation expect this you have given all.

    Please tell me how it possible???

    my mail ID: ashok.just4u@gmail.com

  32. David Anson says:

    Ashok N,

    I'm planning to blog an example of dynamic theme changes soon – I just haven't gotten to it yet. I might get to it later this week if all goes well. Thanks for your patience! 🙂

  33. David Anson says:

    Ashok N,

    Wow, it looks like I won't need to write that post after all! Laurent Duveau has just posted the following article which covers the scenario in more-or-less the same way I was going to:

    weblogs.asp.net/…/dynamically-apply-and-change-theme-with-the-silverlight-toolkit.aspx

    Hope that helps!

  34. Mark says:

    Why does the window background get "themed" when an explicit style is used, but the implicit style doesn't do the same? I'm not going to use the implicit themes (which was one of the main reasons I upgraded quickly to SL 4 ) because it doesn't act the same as explicit themes.

    Also, why don't the toolkit themes work right for charts?  About have the charts in the Samples don't show legend content depending on the theme used.  Doesn't anyone test these things?

  35. David Anson says:

    Mark,

    An implicit theme will automatically apply to any eligible element that matches its TargetType and is *below* its definition in the element tree. So if you're trying to theme one of the topmost elements, you need to be sure to add the implicit style somewhere *above* it – which is tricky for those topmost elements. What you might try is adding the implicit style to App.xaml instead, where it should automatically apply to just about everything. This behavior should all be the same as on WPF, so while it may not be working exactly as you expect, it is following some well-established rules. 🙂

  36. Neelu says:

    Do we have any Spline charts and surface charts available in WPF Toolkit ?

  37. David Anson says:

    Neelu,

    Not that I'm aware of – but if you write one and share it, I'd love to add it to my links collection: http://cesso.org/r/DVLinks 🙂

  38. Andrew says:

    Powerful!

    That is what I want!

  39. teyc@msn.com says:

    I'm trying to put my .xap file on a diet using Assembly Library Caching.

    Can you build System.Windows.Controls.Toolkit.Internals.dll so that they can be cached?

  40. David Anson says:

    teyc,

    All it takes to enable Assembly Library Caching is an "extmap" file which you can create yourself. The MSDN article outlines the process and describes how to do so: msdn.microsoft.com/…/dd833069(VS.95).aspx

    The Silverlight Toolkit ships with extmap files for nearly all its assemblies (though it looks like the Internals one was overlooked), so you should be able to start with one of them for an even easier time. 🙂

    Hope this helps!

  41. mike says:

    Hey Silverlight Team – congrats on releasing a huge API with ABSOLUTELY NO DOCUMENTATION.  Really nice.  I did find the Toolkit Samples Site, lot's a great samples, but the XAML and .cs code files don't have the references resources (like SampleGenerator for the BarChart) and StaticResources, so it can't run.  And, the BarChart sample has a dozen great samples, but the XAML doesn't have any of it.  

    You guys are what my old VP used to call "Propeller Heads".  All you think about is your own code, and so you don't put any effort into documenting it.  You suck.  Programmers like you at Microsoft are the reason why lots of us programmers in the real world are abandoning Microsoft and moving to PHP, HTML5, CSS3, Python, anything but crappy Microsoft.  

    I htink Microsoft Object Modeling has improved alot since 2000.  Your older object models are nonsense, I think back in those days there wasn't one single programmer at Microsoft that knew anything about OOP – you were publishing API's that were obviously Mainframe-oriented code wrapped in an OO language.  But MS got better.  But this toolkit, it might be great, but with no documentation how will I ever find out?  

  42. David Anson says:

    mike,

    This doesn't address all of your concerns, but you should have a "Sample Source Code" link under the "Microsoft Silverlight 4 Toolkit April 2010" folder in your Start Menu. Clicking it will open a folder with a ZIP file containing the complete (buildable) source code for all the samples and another with the complete source code for the Toolkit itself.

    If you're interested in more examples of charting, I've collected a bunch of useful links here: http://cesso.org/r/DVLinks

    Hope this helps.

Comments are closed.