.NET & Funky Fresh



  • <script type="text/javascript" src="http://ws.amazon.com/widgets/q?ServiceVersion=20070822&amp;MarketPlace=US&amp;ID=V20070822/US/bluspiconinc-20/8001/8b68bf4b-6724-40e7-99a5-a6decf6d8648"> </script>
Porting NHProf from WPF to Silverlight - Day 3

On Monday I spent a good four hours working on the port. I decided to flesh out the functionality of the Main Menu. As I mentioned before, none of the menu controls available support commanding. Fortunately, Caliburn has its own mechanism which is much richer than what you get out of the box anyways. So, I began hooking this up, fleshing out the appropriate commands and implementing the various features of the application related to them. This approach actually brought me in touch with a very wide range of the application’s features. As a result, I ended up hitting a lot of issues. I calculated, that on average, I was hitting a *new* API issue (one I hadn’t seen previously on this project) every ten minutes for the entire four hour period. That was frustrating to say the least. Below is a (hideous) screenshot and a list of the issues I hit.

NHProf Day 3

  1. Style.Triggers are not supported. Ultimately this means we are going to have to refactor a lot of styles. Temporary fix to get things running was to comment out the triggers ;(
  2. DataTrigger not supported either. We’ll probably end up refactoring to VSM. Unfortunately, many of our DataTriggers are in Styles…Fixing this is going to be interesting.
  3. Custom Markup Extensions are still not supported in SL4, even after they completely re-wrote their Xaml parser from the ground up to support greater extensibility. My particular scenario was easy to work around by creating a custom IValueConverter. Another reasonable solution might be to create custom attached properties.
  4. Lack of Command Support on Menu controls – This is not a problem with SL4 (except that it doesn’t have any menu controls), but is an issue with the current 3rd party controls. As I mentioned above, Caliburn made this easy enough to work around.
  5. OpenFileDialog is missing CheckFileExists, Title, FileName and RestoreDirectory – We can work around all of this. The major consequence is that the user’s experience with the OpenFileDialog will be degraded.
  6. Missing Timeline.DesiredFrameRate – Apparently you can’t control animation frame rate in Silverlight. I don’t think this will be a major issue.
  7. The following simple storyboard scenario does not work.  There’s seams to be a problem setting Storyboards with StaticResource. I used a bit of code-behind to start the animation. There’s probably a better way. Anyone have an idea?
  8. <UserControl.Triggers>
            <EventTrigger RoutedEvent="FrameworkElement.Loaded">
                <BeginStoryboard Storyboard="{StaticResource RhinoCharging}" />
  9. SaveFileDialog missing Title and FileName – Again, this can be worked around. Mostly it involves a degraded user experience.
  10. Process.Start is missing – There was talk of getting something like this into SL4.  It would have been nice. We need it to open default apps for certain file types on the OS. We’ll either do without this or push it to our backend (which is not Silverlight).
  11. Enum.GetValues is missing!  I found this nice workaround:  http://www.dolittle.com/blogs/einar/archive/2008/01/13/missing-enum-getvalues-when-doing-silverlight-for-instance.aspx
  12. File.WriteAllText is internal. It would have been nice to have this, but we can work around it using Streams, etc.
  13. Missing SystemParameters.PrimaryScreenHeight and SystemParameters.PrimaryScreenWidth.  We’ll just have to do without…
  14. Missing Serializable and BinaryFormatter.  This is a real pain. Many people have asked for this since SL2, but the SL team hasn’t shown any interest in providing this. We are going to have re-write our user settings mechanism.
  15. Missing Button.IsDefault and Button.IsCancel. This can be worked around. It means adding custom keyboard wire-ups for modal dialogs. Yuck.
  16. No Label control – Now that we have ElementName binding why don’t we have a decent label control with Target and ActivatorKey? In the mean time I am using a TextBox.  We’ll probably have to fix this with a custom control.
  17. Bindings on DPs don’t default to TwoWay where appropriate. This is mostly an annoyance.
  18. No ValueConversionAttribute to decorate value converters with. Not a big issue. But you need to remove it before you can compile.
  19. Missing Visibility.Hidden. Again, not a big issue. But, you will need to rework code that uses this to use Opacity and IsHitTestVisible.
  20. Missing DependencyPropertyKey. – We had a custom control that required this. We will have to re-write this control.
  21. Missing FrameworkPropertyMetadata. – Same as above.
  22. DependencyProperty is missing OverrideMetadata – Same as above.
  23. TextBox is missing MinLines and MaxLines – We’ll manage without this by hardcoding height in pixels (yuck!)

Posted 03-31-2010 9:58 AM by Rob Eisenberg



Bob wrote re: Porting NHProf from WPF to Silverlight - Day 3
on 03-31-2010 11:58 AM

Curious if anyone on the Silverlight or WPF team is reading this and if they have any feedback.  As someone who attempted the same thing trying to port a WPF app to SL 3, we eventually just threw our arms up and went with ClickOnce.

Tom wrote re: Porting NHProf from WPF to Silverlight - Day 3
on 03-31-2010 1:04 PM

You're doing the community a great service with this series of posts.  Thank you, and please continue!

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Google Reader or Homepage

del.icio.us CodeBetter.com Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl CodeBetter.com Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of Devlicio.us
Red-Gate Tools For SQL and .NET


SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
NHibernate Profiler
Balsamiq Mockups
JetBrains - ReSharper
Web Sequence Diagrams
Ducksboard<-- NEW Friend!


Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers


Community Server (Commercial Edition)