DCSIMG
April 2011 - Posts - Alex Golesh's Blog About Silverlight Development

April 2011 - Posts

MIX11–Day 2

Second day started with Keynotes. Two hours of cool demos, upcoming Windows Phone 7 features show-up, Silverlight 5 Beta announcement, and upcoming Kinect SDK announcement. Finally ScottGu announced that all attendees are getting Kinect! Good present and very smart marketing move – I knowpersonally at least 3 attendees who have to buy Xbox360 now

Smile

The rest of my day was full of recently announced Windows Phone 7 “Mango” sessions – Overview, Fast application switching, Mango tools enhancements,  Windows Phone Mango platform architecture, Multitasking.

Last MIX day I will go for the rest of Windows Phone Mango sessions.

 

Stay tuned,

Alex

Windows Phone “Mango”–What’s coming in near future?

During 2nd day keynotes ScottGu and Joe Belfiore announced upcoming version of Windows Phone – codename Mango. They demostrated a cool demos and provided information about upcoming features.

The update for developer tools will ship in near future as Scott said.

The highlights of features for upcoming release are:

  • Multitasking: fast app switching (FAS) and Windows Phone background agents.
  • IE9 is coming to Windows Phone with HTML5 support.
  • Additional sensor and runtime access: Additional sensor APIs are being added in Mango, including camera stream access to enable augmented reality scenarios, compass and gyro APIs to enable more advanced detection of motion, and the ability to use socket connections to move beyond HTTP.
  • Structured storage: added the ability to package and deploy SQL CE databases onto the Windows Phone platform, and use LINQ to SQL to access the data. Additionally, new contact and appointment chooser tasks to access the user’s address book and calendar on the device.
  • The version of Silverlight updated – Mango is Silverlight 4 enabled
  • XNA/Silverlight integration: With Windows Phone Mango, SL and XNA could be used in same application, making it easier for developers to build 3D-modeled applications that can overlay Silverlight forms and strings – allowing developers to build next-generation mobile apps that combine the best of our two developer frameworks.
  • Tooling investments: Additional capabilities around the Profiling tooling, new enhancements to the Windows Phone Emulator allowing developers to manipulate sensor data (i.e., GPS, accelerometer) into the emulator.

Stay tuned for more!

Alex

Silverlight 5 Beta

Silverlight 5 Beta availability just announced by ScottGu!

To try the beta follow this link and download the tools. Optionally download Blend 4 for Silverlight 5 preview from this location.

Note: to install Silverlight 5 Beta you need to updated your Visual Studio 2010 with SP1.

The major improvements in Silverlight 5 are:

  • Hardware Decode and presentation of H.264 encoded videos
    • Improves performance for lower-power devices to render high-definition video using GPU support
  • (Long awaited) TrickPlay - allows video to be played at different speeds and supports fast-forward and rewind
    • Note: the audio pitch does not changed in this version
  • Multicolumn text and linked text container
    • enables text to flow around other elements
  • Text characters tracking and leading
    • Controls precisely how far apart each character is for full creative control
  • Debugging XAML databinding (!!!)
    • Allows breakpoints to be set on a binding expression and see the values at runtime
  • Implicit DataTemplates
    • Allows templates to be created across an application to support a particular type by default
  • Databinding support for RelativeSource and ancestor search (much like in WPF)
  • Binding in style setters
    • Enables the databinding to be used within styles to reference other properties
  • Markup extensions
    • Allow code to be run at XAML parse time for both properties and event handlers
    • Note: Unlike WPF, Silverlight supports only named parameters in custom markup extensions
  • 3D API
    • GPU accelerated
    • Immediate mode graphics, pretty similar to XNA
  • Full keyboard support in full screen scenarios
  • Multiple child windows support
    • In elevated out-of-browser mode only

Stay tuned for more info!

Alex

Silverlight 5–What’s new #1

Silverlight 5 Beta were just announced. This post opens a series of “What’s New” posts about the new version. This post focuses on Data Binding and data handling enhancements.

One of the most interesting features is Data Binding debugging support, which enables to place a breakpoint into XAML (databinding expression) and inspect it at the runtime. During the runtime, when the code hits breaking point it just stops as managed code does and enables inspection of all the properties related to the binding expression.

 image

Very helpful, especially with complex data bindings!

The next very helpful feature arrives directly from the “Big Brother” of Silverlight, the WPF. It called implicit Data Templates. From now on, Silverlight applications could define implicit (the default) Data Template for particular type and it will be applied on the runtime while presenting the specific type. Consider the following data type (Employee) defined as the following:

public class Employee : INotifyPropertyChanged
{
    private int id;
    public int ID
    {
        get { return id; }
        set
       
{
            id = value;

            Utils.NotifyPropertyChanged("ID", this, PropertyChanged);
        }
    }

    private string firstName;
    public string FirstName
    {
        get { return firstName; }
        set
       
{
            firstName = value;

            Utils.NotifyPropertyChanged("FirstName", this, PropertyChanged);
        }
    }

    private string lastName;
    public string LastName
    {
        get { return lastName; }
        set
       
{
            lastName = value;

            Utils.NotifyPropertyChanged("LastName", this, PropertyChanged);
        }
    }

    private DateTime birthday;
    public DateTime Birthday
    {
        get { return birthday; }
        set
       
{
            birthday = value;

            Utils.NotifyPropertyChanged("Birthday", this, PropertyChanged);
        }
    }

    private float salary;
    public float Salary
    {
        get { return salary; }
        set
       
{
            salary = value;

            Utils.NotifyPropertyChanged("Salary", this, PropertyChanged);
        }
    }

    #region INotifyPropertyChanged Members

    public event PropertyChangedEventHandler PropertyChanged;

    #endregion
}

While the data class is pretty simple, to present it correct in XAML we need to define some Data Template. In Silverlight 5 the implicit data template definition will enable to create “default” look for specific data type. This will presented in all usages of the data if will not overridden by local definition. Consider the following DataTemplate – pay attaention to lack of the x:Name definition:

<DataTemplate DataType="local:Employee">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height=".5*"/>
            <RowDefinition Height=".5*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <TextBlock FontSize="15">
            <Run Text="{Binding FirstName}"/>
            <Run Text=","/>
            <Run Text="{Binding LastName}"/>
        </TextBlock>
        <TextBlock FontSize="12" Grid.Row="1">
            <Run Text="Salary: "/>
            <Run FontStyle="Italic" Text="{Binding Salary}"/>
        </TextBlock>
        <TextBlock FontSize="12" Grid.Row="2">
            <Run Text="Birthday: "/>
            <Run FontStyle="Italic" Text="{Binding Birthday, StringFormat=dd/MM/yyyy}"/>
        </TextBlock>
    </Grid>
</DataTemplate>

From now on, the only thing needed to present the list of employees is to bind to the collection:

<ListBox ItemsSource="{Binding Employees}" MaxHeight="400"/>

The item will be presented as defined in the default Data Template:

image

To override the default representation, just create additional Data Template for the type and provide it an x:Key.

Next feature helps to deal with the questions like “how I could style the DataTemplate/ControlTemplate according to the context I’m using it?”…

Let’s assume you have 2 pages with completely different background. How to much the visual representation of some part to the page? What if the same part is used in multiple locations with different (for example) backgrounds? To solve this problem, Silverlight 5 has a new feature (once again, long awaited addition from WPF) called RelativeSource. It enables to bind to a property on the control that contains it.

In my case I have a list of employees in different divisions and this list could be presented in a few different pages (with slightly different look and feel). I’d like to match the Division Name to the page color scheme:

<DataTemplate DataType="local:Division">
    <StackPanel Orientation="Vertical" >
        <TextBlock Foreground="{Binding RelativeSource={RelativeSource AncestorType=ContentControl}, 
            Path=Background}" FontSize="20" FontFamily="Trebuchet MS" Text="{Binding DivisionName}"/>
        <ListBox ItemsSource="{Binding Employees}" MaxHeight="400"/>
    </StackPanel>
</DataTemplate>

The interesting part is RelativeSource, which enables to specify the AncestorType, AncestorLevel and the Mode in order to identify the control in the parts tree we are looking for.  In this example the Foreground property of the TextBLock will be taken from ContentControl.Background anywhere above StackPanel in the Visual Tree.

This relative source could also point on the control itself. Consider the following code:

 <TextBox Text="#FF55FFCC" Grid.Row="0" Style="{StaticResource textStyle}"
                 Background="{Binding Text, RelativeSource={RelativeSource Self}}" 
                 Width="200"/>

In this case background of the TextBox changes according to the value of text. The Relative Source points onto “Self”, meaning the control itself – one of the properties of the control.

Consider the following binding expression:

<Border Grid.Column="0" BorderThickness="2" BorderBrush="Black" CornerRadius="2" Margin="2"
                    Background="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl}, Path=Background}"
                    Height="100"
                    Width="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorLevel=2, AncestorType=Grid}, 
Path=Width, Converter={StaticResource halfSizeConverter}}">

The first RelativeSource travels up on the VisualTree and looks for UserControl instance (first which will be found), the second RelativeSource takes the value from Grid exactly 2 levels above.

Next improvement is an ability to databind with style setters. Consider multiple projects in the big company, with company’s color scheme and various font definitions defined by designers as resource. Those values should be used by all applications, but each application could define slightly different combination of them. IN such case a new feature of Data Binding in style setters comes at the right place. Consider the following definition in some general resource dictionary (used in multiple applications and added to the project as a shared source):

<SolidColorBrush x:Key="textBrush" Color="DarkGreen"/>
<sys:String x:Key="textFont">Trebuchet MS</sys:String>
<sys:Double x:Key="textFontSizeHuge">60</sys:Double>

Those definitions should be used in specific application and could be changed by company’s designer from single place:

<Style TargetType="TextBox" x:Key="textStyle">
    <Setter Property="FontFamily" Value="{StaticResource textFont}"/>
    <Setter Property="Foreground" Value="{StaticResource textBrush}"/>
    <Setter Property="FontSize" Value="{Binding Source={StaticResource textFontSizeHuge}, Converter={StaticResource halfSizeConverter}}"/>
</Style>

Now, when the definitions of font name, font size, etc. are changed the application will pick them up (after re-compiling).

The last, but not least is the ability to create our own Markup Extensions. This feature also arrived from WPF and allow code to be run at XAML parse time for both properties and event handlers.

Consider the following code snippet:

public static string StrVal = "Hello from static variable!";

Before markup extensions, there were no way to databind to the static variables. Now, with Markup Extensions it is possible to write XAML like the following:

<TextBlock Text="{local:Static TypeName=Utils.StrVal}"/>

Let’s see how it were built. Custom markup extension is a public class derived from MarkupExtension base class and in simple case have to override only one function:

public override object ProvideValue(IServiceProvider serviceProvider);

Let’s see the simple implementation first:

public class NowExtension : MarkupExtension
{
    public string Format { get; set; }

    public NowExtension()
    {
    }

    public override object ProvideValue(IServiceProvider serviceProvider)
    {
        string retVal = "";

        switch (Format)
        {
            case "F":
                retVal = DateTime.Now.ToShortDateString();
                break;
            case "FF":
                retVal = DateTime.Now.Year + "/" + DateTime.Now.Month + "/" + DateTime.Now.Day + ", " + DateTime.Now.DayOfWeek;
                break;
            case "FFF":
                retVal = DateTime.Now.ToLongDateString();
                break;
            default:
                retVal = DateTime.Now.ToShortDateString();
                break;
        }

        return retVal;
    }
}

This class returns formatted Date representation by given parameters. Note, that the usage omits the “Extension” part of the class name. The usage of such class (NowExtension) in XAML:

xmlns:local="clr-namespace:DataBindingImprovements"

<TextBlock Text="{local:Now Format=FFF}"/>

At the runtime when the ProvideValue method executes it provides the current date formatted according to the parameter.

Now let’s get back to the static variable case. The markup  extension in this case is slightly longer, since we need to resolve the static value at the runtime from its text/name:

public class StaticExtension : MarkupExtension
{
    Type t;
    FieldInfo f;

    public StaticExtension()
    { }

    private string typeName;
    public string TypeName 
    {
        get { return typeName; }
        set
        {
            typeName = value;

            initializeInfo(typeName);
        }
    }

    private void initializeInfo(string typeName)
    {
        string[] val = typeName.Split(new char[] { '.' });
        t = Type.GetType(GetType().Namespace + "." + val[0], false, true);

        if (null != t)
            f = t.GetField(val[1], BindingFlags.Static | BindingFlags.Public);
    }

    public override object ProvideValue(IServiceProvider serviceProvider)
    {
        if (null != f)
            return f.GetValue(null);
        else
            return null;
    }
}

The code is pretty self-describing, and the usage is the following:

<TextBlock Text="{local:Static TypeName=Utils.StrVal}"/>

Now we could use the static variables from XAML.

image

That’s it for the first part.

The sources for the application I used to show the features could be found here.

In the next part I’ll show the tear-off windows support in out-of-browser applications.

Stay tuned,

Alex

Silverlight 5–What’s New #3

This is a third post in a series of “What’s New?” posts about Silverlight 5. In this post I’ll show number of features.

First one to start with it an ability to control the text characteristics like characters spacing, line stacking, etc. Consider the page title; consider that according to UI artist decision the text should span over the whole page width. In this case you will find a new TextBlock’s  handy property called “CharacterSpacing”.

<TextBlock Text="TrickPlay Sample" FontFamily="Trebuchet MS" 
                   FontSize="30" HorizontalAlignment="Center" 
                   CharacterSpacing="300"/>

Produces the following text:

image

while CharacterSpacing=”50” produces the following result:

image

Next, is a feature related to ReachTextBox. What happens if the control is not big enough to hold all the text? In such case the Overflow feature is very handy.

In my case I have extremely small RichTextBox with pretty long content and additional Rich Text Box Overflow element to hold the text which cannot fit the original control:

<RichTextBox Width="50" Height="50" OverflowContentTarget="{Binding ElementName=overflowRTB}">
    <Paragraph TextAlignment="Center">Very long movie description that doesn't fit 50x50 RichTextBox control</Paragraph>
</RichTextBox>
<RichTextBoxOverflow x:Name="overflowRTB"/>

This produces the following result:

image

and the long text keeps flowing into the overflow part when user keeps typing:

image

Last feature I want to show in this part is a TrickPlay – ability to change the MediaElement’s playback rate. In the following example I have a playback rate of MediaElement connected to the Slider’s value:

<MediaElement x:Name="media" Height="200" Stretch="Uniform" Volume="0" 
                AutoPlay="True" MediaEnded="media_MediaEnded" Source="/video.wmv"
                PlaybackRate="{Binding ElementName=sldSpeed, Path=Value}"/>
<Slider x:Name="sldSpeed" Minimum="0.25" Maximum="4" SmallChange="0.25" LargeChange="1"
        Value="1" Grid.Row="1" HorizontalAlignment="Center" Width="400"/>

This enables me to control the playback rate of the video:

image

The source used in this post is hosted here.

Note: to save on size I’ve removed the video file. Add any wmv video file as a content resource and rename it to video.wmv to make the sample work again.

Next time I’ll show how to use Silverlight’s 5 3D graphics.

Alex

Silverlight 5–What’s New #4

This post is dedicated to 3D graphics in Silverlight 5. The graphics engine is pretty similar to XNA and for better understanding I suggest to read some 3D graphics theory and some XNA documentation.

To display the 3D graphics Silverlight 5 adds a new FrameworkElement called “DrawingSurface”. To use it, first you application must have GPU acceleration enabled at the Silverlight plug-in level:

<param name="EnableGPUAcceleration" value="true" />

Once your plug-in set, the new element could be added and used from XAML:

<Grid x:Name="LayoutRoot" Background="LightGoldenrodYellow">
        <DrawingSurface x:Name="surface" Draw="DrawingSurface_Draw" 
                        SizeChanged="DrawingSurface_SizeChanged"/>
</Grid>

The 3D graphics works in immediate graphics mode and draws directly on the screen surface. In order to draw the application should subscribe to the Draw event; this event will be called every time the application should draw a new frame.

In order to draw at the 3D model (even the simplest one I’ll use for this sample) we still need to initialize pretty much things. The minimum initialization set includes the model vertices and the “camera”. In my case I’ll also initialize the texture to paint on the model. I’ll use pixel & vertex shaders to apply texture on the model. The shaders should be compiled and added to the solution as a resources:

image

To create a shaders you have to use a High Level Shader Language (HLSL) and compile into binary form to be used in the application. Compilation cold be done with DirectX SDK command line tool called “fxc.exe”. Once compiled and added as resources to the project they could be loaded at the runtime and initialized as a managed class instance:

VertexShader vertexShader;
PixelShader pixelShader;
Stream shaderStream = Application.GetResourceStream(new Uri(@"3DSample;component/OurHLSLfile.vs", UriKind.Relative)).Stream;
vertexShader = VertexShader.FromStream(device, shaderStream);

shaderStream = Application.GetResourceStream(new Uri(@"3DSample;component/OurHLSLfile.ps", UriKind.Relative)).Stream;
pixelShader = PixelShader.FromStream(device, shaderStream);

For shader initialization the application should provide an instance of GraphicsDevice which could be obtained from GraphicsDeviceManager:

GraphicsDeviceManager graphics;
GraphicsDevice device;
graphics = GraphicsDeviceManager.Current;
device = graphics.GraphicsDevice;

The Texture2D instance from resource is according to the following:

Texture2D streetTexture;
// Load image for texture
Stream imageStream = Application.GetResourceStream(new Uri(@"3DSample;component/streettexture.png", UriKind.Relative)).Stream;
var image = new BitmapImage();
image.SetSource(imageStream);

// Create texture           
streetTexture = new Texture2D(graphics.GraphicsDevice, image.PixelWidth, image.PixelHeight, false, SurfaceFormat.Color);

// Copy image to texture
image.CopyTo(streetTexture);

Now to the camera creation. We have to specify the position of the camera in a 3D space, the view matrix (where camera looks at) and the projection matrix (perspective field of view of the camera):

Microsoft.Xna.Framework.Matrix viewMatrix;
Microsoft.Xna.Framework.Matrix projectionMatrix;
Vector3 cameraPos;
float aspectRatio = (float)surface.ActualWidth / (float)surface.ActualHeight;

cameraPos = new Vector3(-25, 13, 18);
viewMatrix = Microsoft.Xna.Framework.Matrix.CreateLookAt(cameraPos,
    new Vector3(0, 2, -12), new Vector3(0, 1, 0));
projectionMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4,
    aspectRatio, 1.0f, 200.0f);

When the camera is set (in my case static camera looking to the specific point in space) I’ll setup my model. The model could be specified my model file (like .X or .FBX) or as a set of Vertices.

Note: Unlike XNA, Silverlight 5 doesn’t provide any built-in model importer, which means the model files need to be loaded and parsed by developer at runtime. 

To load information about my very simple model I used the following structure (combines the vector position and corresponding coordinate at the texture):

public struct VertexPositionTexture
{
    public Vector3 Position;
    public Vector2 UV;

    public VertexPositionTexture(Vector3 position, Vector2 uv)
    {
        Position = position;
        UV = uv;
    }

    public static readonly VertexDeclaration VertexDeclaration = new VertexDeclaration(
        new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0),
        new VertexElement(12, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0));
}

The initialization of vertices is the follows:

VertexBuffer vertexBuffer;
VertexPositionTexture[] vertices = new VertexPositionTexture[12];

vertices[0] = new VertexPositionTexture(new Vector3(-20, 0, 10), new Vector2(-0.25f, 25.0f));
vertices[1] = new VertexPositionTexture(new Vector3(-20, 0, -100), new Vector2(-0.25f, 0.0f));
vertices[2] = new VertexPositionTexture(new Vector3(2, 0, 10), new Vector2(0.25f, 25.0f));
vertices[3] = new VertexPositionTexture(new Vector3(2, 0, -100), new Vector2(0.25f, 0.0f));
vertices[4] = new VertexPositionTexture(new Vector3(2, 1, 10), new Vector2(0.375f, 25.0f));
vertices[5] = new VertexPositionTexture(new Vector3(2, 1, -100), new Vector2(0.375f, 0.0f));
vertices[6] = new VertexPositionTexture(new Vector3(3, 1, 10), new Vector2(0.5f, 25.0f));
vertices[7] = new VertexPositionTexture(new Vector3(3, 1, -100), new Vector2(0.5f, 0.0f));
vertices[8] = new VertexPositionTexture(new Vector3(13, 1, 10), new Vector2(0.75f, 25.0f));
vertices[9] = new VertexPositionTexture(new Vector3(13, 1, -100), new Vector2(0.75f, 0.0f));
vertices[10] = new VertexPositionTexture(new Vector3(13, 21, 10), new Vector2(1.25f, 25.0f));
vertices[11] = new VertexPositionTexture(new Vector3(13, 21, -100), new Vector2(1.25f, 0.0f));

var vb = new VertexBuffer(device, VertexPositionTexture.VertexDeclaration,
    vertices.Length, BufferUsage.WriteOnly);
vb.SetData(0, vertices, 0, vertices.Length, 0);

vertexBuffer = vb;

Now, when the vertices are initialized the model could be presented during the draw call:

device = e.GraphicsDevice;

//Clear the surface
device.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, theColor, 1.0f, 0);

//Calculate the world view projection
Matrix worldViewProjection = viewMatrix * projectionMatrix;

//Set Vertex Buffer & Vertex shader
device.SetVertexBuffer(vertexBuffer);
device.SetVertexShader(vertexShader);
device.SetVertexShaderConstantFloat4(0, ref worldViewProjection);

//Set Pixel Shader
device.SetPixelShader(pixelShader);
device.Textures[0] = streetTexture;
device.DrawPrimitives(PrimitiveType.TriangleStrip, 0, vertexBuffer.VertexCount);

//Invalidate the surface to make sure it redraws
e.InvalidateSurface();

The result looks like the following:

image

The sources of the project are here.

 

Stay tuned,

Alex

Silverlight 5–What’s New #2

This is a second post in series of posts about new features in Silverlight 5.

This post focuses at simple, yet much desired feature of multiple windows support.

First – some clarification: multiple windows will work in elevated out-of-browser mode only.

To demonstrate this feature I’ve built simplest application which spans 5 additional windows on button click.

The “child” window presents a UserControl. Child window content:

<UserControl x:Class="MultipleWindows_OOB.ChildWindowContent"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">
    
    <Grid x:Name="LayoutRoot" Background="LightGoldenrodYellow">
        <TextBlock HorizontalAlignment="Center" TextAlignment="Center" 
                   FontFamily="Courier New" FontSize="22">
            <Run Text="This is a secondary window"/>
            <LineBreak/>
            <Run Text="#"/>
            <Run Text="{Binding WindowNumber}"/>
        </TextBlock>
    </Grid>
</UserControl>

The “WindowNumber” defined as Dependency Property in code behind as follows:

private int windowNumber;
public int WindowNumber 
{
    get { return windowNumber; }
    set
    {
        windowNumber = value;

        if (null != PropertyChanged)
            PropertyChanged(this, new PropertyChangedEventArgs("WindowNumber"));
    }
}

public event PropertyChangedEventHandler PropertyChanged;

Now to the interesting part – spawning a new windows:

if (App.Current.IsRunningOutOfBrowser && App.Current.HasElevatedPermissions)
{
    for (int i = 0; i < 5; i++)
    {
        Window wnd = new Window();
        wnd.Width = 640;
        wnd.Height = 480;
        wnd.Left = 25 + i * 20;
        wnd.Top = 30 + i * 30;
        wnd.WindowState = WindowState.Normal;
        wnd.WindowStyle = WindowStyle.SingleBorderWindow;
        wnd.Title = "Child Window #" + (i + 1);
        wnd.Content = new ChildWindowContent() { WindowNumber = (i + 1) };
        wnd.Visibility = System.Windows.Visibility.Visible;
    }
}
else
    MessageBox.Show("This works only in Elevated OOB mode!");

Pretty simple, ah? At running application looks like the follows:

image

Note: closing the main window will close all the child windows.

The sample located here.

 

Stay tuned for more to come soon.

Alex

MIX11–Day 1

Some updates of first day I had at MIX11:

Keynotes

2 main speakers at the keynotes presented the recent achievements in IE9 and Visual Studio since last MIX. Dean presented beautiful HTML 5 demos and introduced IE10 preview. The version available for download from this location. Scott presented new additions to MVVM and EF4.1.

HTML5 for Silverlight Developers (Georgio Sardo)

This session meant to help the Silverlight developers (like myself) to understand the world of HTML5. Georgio did really great job to create a parallels between Silverlight and HTML5 features, presented with capabilities of HTML5 and few missing features which could be easily filled by Silverlight. Nice session!

Next (after launch break) I’ve been at Deep Dive MVVM (by Laurent Bugnion).

The session was very good, with many real-world samples and real-life code. Good one, Laurent!

 

All the videos from the sessions and all the code should be posted at MIX11 website shortly.

 

Stay tuned,

Alex

Posted by Alex Golesh | with no comments