Customizing Silverlight Child window title/Adding Image on title


Today I have found a nice feature of child window control in Silverlight and. I had a requirement in my project to display a image beside the window title after some R&D i found that it is having a property is an “Objecy” and I assumed that it could be act as a contentPresenter/ContentControl.

we can do it like this:

<sdk:ChildWindow          xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation&#8221;

xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml&#8221;

xmlns:sdk=”http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk”                x:Class=”SilverlightApplication1.ChildWindow1″

Width=”400″ Height=”300″>

<sdk:ChildWindow.Title>

                                <StackPanel Orientation=”Horizontal”>

                                                <Image Source=”Profile.png” Width=”24″ Height=”24″ />

                                                <TextBlock Text=”Add User” Margin=”15,5″ />

                                </StackPanel>

                </sdk:ChildWindow.Title>

<Grid x:Name=”LayoutRoot”>

<Grid.RowDefinitions>

<RowDefinition />

<RowDefinition Height=”Auto” />

</Grid.RowDefinitions>

<Button x:Name=”OKButton” Content=”OK” Click=”OKButton_Click” Width=”75″ Height=”23″ Margin=”0,0,79,0″ HorizontalAlignment=”Right” Grid.Row=”1″ />

<Button x:Name=”CancelButton” Content=”Cancel” Click=”CancelButton_Click” Width=”75″ Height=”23″ HorizontalAlignment=”Right” Grid.Row=”1″ />

</Grid>

</sdk:ChildWindow>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s