Window Support

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Sunday, 15 May 2011

Multiple Window Support in Silverlight 5

Posted on 09:02 by Unknown

So much talks about Multiple Window support in Silverlight 5 which made available in beta version around various Silverlight blogs and forums.I am putting my few thoughts here on this feature.

The basic idea behind this feature is host stuff across multiple windows,remember the good old days of MDI forms in Visual Basic 6 days? well its not I will say replica of but its of similar kinds.

The bookish meaning of Multiple Window support is :

The ability to create an application that can have additional top level windows other than the single window that's opened for a Silverlight Out of Browser application

Game starts with namespace System.Windows.Window and it looks like following :

#region Assembly System.Windows.dll, v4.0.30319
// C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v5.0\System.Windows.dll
#endregion

using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Security;

namespace System.Windows
{
    // Summary:
    //     Represents an out-of-browser application window.
    public sealed class Window : DependencyObject
    {

        //… some code

     }

}

It’s a sealed class inherited from Dependency Object and as class level xml comment shouts, its an OOB and Work only in Elevated Trust Applications.

elevtrust

You can achieve Multiple Window like this :

Window tearOffWindow = new Window();
//Once a Window has been instantied, one can
//set its initial property values    

tearOffWindow.Height = 300;
tearOffWindow.Width = 400;
tearOffWindow.Top = 24;
tearOffWindow.Left = 30;
tearOffWindow.Title = "Tear Off Stack Panel";
tearOffWindow.Content = mnp.movUIElement; /*Set Content to someFrameworkElement Obj*/;

//Once all the initial properties have
//been set, set the Visibility property
//to 'Visible' to display the Window
tearOffWindow.Visibility = Visibility.Visible;

It will look something like this :

TearCapture

Like this you can create instance of window and put stuff on that whatever you feel appropriate to your application or per requirement. Note that once you close main window another window instance will be closed as well. Its very ideal feature for many Line of Business applications as well. So you should give try to this one today. I know there will be lot more can be done with this,but for the moment I am restricting myself,In upcoming posts I will share more with some demo apps and how you can use this feature at best.

Issues I observed with Multiple Window :

1. Background color/Background property Mystery :

While working I came across that there does not exists any Background property via code which I find strange personally.

TearOff_Error

2. “Black” Background color :

If you do not set any background color to your UIElement which you are going to tear off,It applies Black color automatically. Some videos and blogs says this is “By default” or “Automatic” but I don’t believe on this,how it can be “by default” since if I don’t apply any background color it should be whitish as usual.This I personally find very strange.

BugTearCapture

3. Setting WindowStyle as “BorderlessRoundCornersWindow” :

Though it works for parent window well,I will not say this as bug or limitation but if its not expected then they should have thrown compile time error to prompt that it cannot be mixed with Multiple Window support feature but it throws exception here  :

TearOff_Border_Error

Well, despite of these small issues which I think either might be resolve in coming bits or can be carry ahead ignoring but I feel that I should share this with you so that while designing app based on this Multiple Window feature you will be in good position with possible problems and solution.

I will soon post more deep dive article with some more good examples and features but now my mind is in Hyderabad city where 100+ South Asian MVPs are coming together for Microsoft MVP Open Day 2011 .. I will be traveling there for few days..So see you soon with more good stuff from May end onwards.

Vikram.

Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • First Windows Phone 7 update February 2011 - Small update but Big start
    After tons of rumors and set of predictions on Windows Phone 7 all over Internet, Microsoft came up with first Windows Phone 7 minor update ...
  • The little Story of “I Unlock Joy” event by Microsoft and Pune User Group
      This post is about recent “I Unlock Joy” event happened in Pune which was conducted by Microsoft and Pune User Group. Little History : ...
  • Silverlight On Mobile : Windows Phone 7 Splash Screen and Customization
    After talking about 3D capabilities on Windows Phone 7 using Silverlight in last article , Now I am moving ahead with small but equally impo...
  • Silverlight 5 : Platform Invoke (PInvoke) in Silverlight
      Two days back Microsoft announced availability of Silverlight 5 RC,I encourage you to download bits from here , My friend Pete Brown alr...
  • Introduction to Speech Capabilities in Windows Phone 8 – Part 1
    After a long..I am writing blog, I hope and I wish I will resume blogging like I use to in past. Lots of things happened in past few months....
  • MCTS : Microsoft Silverlight 4 Development Exam Guide (70-506) by Packt Publishing
      Hello, After a long time I got chance to come back here.I will soon resume blogging in month of August. Last 4-5 months were horrible due...
  • Introduction to Speech Capabilities in Windows Phone 8 – Part 2
    Hope you enjoyed my last article on Speech Capability in Windows Phone 8, Today I am posting another part or you can say little extension t...
  • Silverlight 3 : Insert & Update Data using WCF Service with DataForm and DataGrid
    In my Lap around Silverlight 3 series, I have written a separate article on DataForm in Silverlight 3, This article is a basic extension to ...
  • Mango : Using DeviceStatus in Windows Phone 7.1
    First of all “Thank You” for your wonderful response and comments on my last article on Silverlight Vs HTML5 ,I hope you like the points I ...
  • Silverlight, HTML5 & Windows 8 : Where we are heading to ?
    This is not the post or yet another post on most happening debate of Silverlight and HTML5, This is just a visit to all of them to realize t...

Blog Archive

  • ►  2013 (4)
    • ►  August (1)
    • ►  April (3)
  • ►  2012 (4)
    • ►  July (1)
    • ►  March (2)
    • ►  January (1)
  • ▼  2011 (24)
    • ►  December (1)
    • ►  September (4)
    • ►  August (2)
    • ►  July (1)
    • ►  June (4)
    • ▼  May (3)
      • Mango : DeviceNetworkInformation in Windows Phone 7.1
      • Mango : What’s new in Windows Phone 7.1
      • Multiple Window Support in Silverlight 5
    • ►  April (3)
    • ►  March (1)
    • ►  February (4)
    • ►  January (1)
  • ►  2010 (21)
    • ►  December (1)
    • ►  November (2)
    • ►  October (3)
    • ►  September (2)
    • ►  August (4)
    • ►  July (5)
    • ►  May (1)
    • ►  April (1)
    • ►  March (1)
    • ►  January (1)
  • ►  2009 (49)
    • ►  December (1)
    • ►  November (5)
    • ►  October (2)
    • ►  September (1)
    • ►  August (5)
    • ►  July (5)
    • ►  June (1)
    • ►  May (5)
    • ►  April (5)
    • ►  March (9)
    • ►  February (4)
    • ►  January (6)
  • ►  2008 (43)
    • ►  December (3)
    • ►  November (9)
    • ►  October (7)
    • ►  September (4)
    • ►  August (2)
    • ►  July (3)
    • ►  June (4)
    • ►  May (3)
    • ►  March (3)
    • ►  February (5)
Powered by Blogger.

About Me

Unknown
View my complete profile