Pages

Tuesday 12 March 2013

Frame Control in WPF

Frame Control in WPF

The Frame control in WPF supports content navigation within content. A Frame can be hosted within a Window, NavigationWindow, Page, UserControl, or a FlowDocument control.

XAML code -


<Window x:Class="WpfApplication5.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300">
    <Grid Width="224">
        <TextBlock>Outside area of frame</TextBlock>

        <Frame Source="Page1.xaml">
           
        </Frame>
    </Grid>
</Window> 
 
The Window looks like as below in picture. The Blue area is the Page1.xaml and white area is outside of the Frame. 
 


Now you can manage contents of a frame the way you want. For example, the following code rotates the contents of frame to 45 angle.


<Frame Source="Page1.xaml">

    <Frame.LayoutTransform>

        <RotateTransform Angle="45" />

    </Frame.LayoutTransform>

</Frame> 
 
Output -

No comments:

Post a Comment