| Comments

UPDATE: FloatableWindow is now on CodePlex for easier community contributions and management of latest source and builds.  FloatableWindow CodePlex Project. If you like this idea VOTE FOR IT in the Silverlight Toolkit!

A while back I wrote a post where I refactored the Silverlight ChildWindow to create a non-modal window and I called it FloatableWindow (you can see why I’m not a good marketer…hey I could have called it Microsoft Silverlight ChildWindow Refactored Edition Express).  A few folks found it useful, for which I’m appreciative of the comments.

My buddy Karl Shifflett decided to use it in Glimpse as the diagnostic window – thanks Karl!  Karl even added some code to it to basically provide a start position (HorizontalOffset and VerticalOffset).  Another request Karl had was to add resizing capabilities to the window.

I’m pleased to say that I added both of these features to the source.  I modified Karl’s offset properties a bit to not only include them in the Show() override, but also as public properties that would be used if available.  For resizing, I added a ResizeMode property which matches the System.Window.ResizeMode enumeration.  I chose to use that enumeration for some consistency with WPF APIs, but frankly it really only supports CanResize and NoResize with the default being CanResize.  You can see an example of the resizing capabilities here in this animation:

As you can see (sorry for the horrible animated image but just wanted to make it simple), the resizing handle will appear in the lower right corner of the window.

UPDATE: Based on Laurent/yaip’s feedback I reverted back to my original design, here’s the mouse out (normal) and mouse over states for the handle:

 

  I chose to make it invisible unless someone moves their mouse into that position.  Is that the wrong UX do you think?  I know it isn’t entirely consistent with something like WinForms, but I wanted to be a little different. 

Additionally I wanted to use the SizeNWSE Cursor as a normal WPF/WinForm window would use, but unfortunately that’s not a valid Cursor for Silverlight right now.

I did try to make the resizing adorner a template part so you could make it something else (right now it is just a path).  I haven’t really tried messing with it that much though.

I think my math might be a bit off in some scenarios and I’m still frustrated with the Popup and ZIndex issue in Silverlight, but I know there is an open issue for Silverlight to look at this so I’m trying to stay calm about it.  Anyhow, some subtle adds to make it hopefully just a bit more useful for anyone who cares (or cares to learn from it).

You can download the source code here: FloatableWindow_1.3.zip

Hope this helps and I appreciate any comments regarding the update or if you see issues in your scenarios. 

| Comments

There seems to be a lot of buzz around Silverlight lately and I admit, I like it :-).  But I also think that there is a huge misconception about Silverlight “replacing” WPF.  I get emails a lot about people asking me questions about Silverlight and after a bit of prodding, I see that their target platform for their application is Windows.  I then begin my rant on why it should be WPF if that is the target platform.  I’m usually met with some weird looks being that I do a lot of Silverlight, but I state my case accordingly.

The conversation usually follows about not understanding WPF or trying to find more information about it.  Well, the WPF teams are trying to change that perception.  In fact, Jaime Rodriquez and Karl Shifflett have been organizing a WPF LOB Tour to provide 2 days of free WPF training for developers.  Jaime is the technical evangelist for WPF and Karl works on the WPF team.  They will be in these cities soon:

  • Los Angeles, CA
  • London, UK
  • New York, NY
  • Chicago, IL
  • Phoenix, AZ

Take a look at what they’ll be covering about WPF:

  • Day One:

    • Lap Around WPF
    • WPF Tools ( Blend, Visual Studio 2008)
    • Graphics Subsystem
    • Layout
    • WPF Fundamentals and new concepts
      • Application Model
      • Dependency Properties
      • Trees (logical & visual)
      • Events
      • Threading
      • Resources
    • Controls
    • Styling
    • Templating
    • Q&A with instructors at end of day
  • Day Two:
    • WPF integration with Win32 and Windows Forms
    • Data binding
    • Introduction to Model-View-ViewModel
    • Commanding in M-V-VM
    • Views, Navigation and Transitions
    • Data Validation
    • Error handling, Model dialogs, Logging
    • Unit Testing
    • MVVM & LOB tips and tricks
    • Q&A with the instructor
  • If this is coming to an area near you, I’d strongly encourage you to make the time to be there.  There is no cost to you other than getting yourself there (if it isn’t in your same city).  Their first event packed a full house on registration within 2 hours and the feedback from the training was overwhelmingly positive and exciting.  Karl is such a dynamic and fun guy to be around, it will be worth your price of admission to hang out with him and Jaime for 2 days.  I’d love for one city to rally together and all show up wearing Hawaiian shirts to make Karl feel at home :-).

You can find all the information about the events on Karl’s blog or Jaime’s blog.  Registration links and everything are listed there.  If you have a question about the event, please reach out to Karl or Jaime.  I know their most asked question is "why aren’t you coming to <fill-in-the-blank-location>?  Honestly after talking to Karl I’m convinced he wouldn’t sleep if he could go everywhere…and he wants to as well!  I think there are some plans to do some studio recordings and produce the information online, but there is no timeframe for that just yet…and I do believe that nothing really supplements being able to network with others learning and being in-person to ask questions, etc.  It’s a great opportunity to learn and demystify WPF development for yourself…really, make the time to be there.

Additionally, there have been some organized XAMLFest events happening around the country (US – but if there are others worldwide, leave a comment where they are happening).  These aren’t 2-day workshop trainings, but are events organized around our XAML technologies, specifically WPF and Silverlight. 

I think WPF and Silverlight are really great technologies and compliment each other well.  Try not to learn one without the other.  I know personally I’m trying to do more WPF learning myself as the natural progression of the Microsoft platform is the continuum of Silverlight to WPF as shared application platforms.  I hope you’ll do the same.

If you’ve attended one of these WPF events listed above, please leave a comment about your feedback as well.