:: Home

  login:         
  passwords:  

WPF FAQs

WPF General Questions
Concepts Element Tree
Concepts Dependency Property
Concepts Attached Property
Concepts Routed Events
Concepts Resources.
Concepts Animation
Concepts Freezable Object
Concepts Input and Commands.
Concepts Layouts
XAML Inline Styles and Templates
XAML XML Namespaces
XAML Code Behind
XAML Custom Class
XAML Type Converters
Content Model ItemControl
Content Model HeaderedItemsControl
Content Model HeaderedContentControl
Content Model Content Control
Content Model Decorator Content Model
Content Model Panel Content Model
Documents Serialization and Storage
Documents Annotations
Documents Flow Content
Documents Printing
Graphics and Multimedia Rendering Graphics
Graphics and Multimedia Animation and Timing
Graphics and Multimedia 2D Graphics
Graphics and Multimedia 3D Graphics
Graphics and Multimedia Visual Layer
Control Customization Adorners
Control Customization Stylable controls
Control Customization ControlTemplates
Data Data Binding
Data DragandDrop
Data Serialization
Globalization and Localization Attributes
Globalization and Localization Comments
Globalization and Localization Globalization Struc
Application and Deployment ClickOnce
Application and Deployment Frame
Application and Deployment Page
Application and Deployment Navigation
Application and Deployment Setup
Application and Deployment Window
Interoperability Message Loops Between
Interoperability Win32 in WPF
Interoperability WPF in Win32
Interoperability Windows Forms and WPF
Security Trusted Security
Security Partial Trust Security
Tools Microsoft Expression Blend
Tools ZAM3D
Tools XAMLPAD
Controls ToolTip
Controls TextBlock
Controls TabControl
Controls ProgressBar
Controls PrintDialog
Controls Popup
Controls TextBox
Controls Canvas
Controls ComboBox
Controls ListBox
Controls StatusBar
Controls ToolBar
Controls Context Menu
Controls Expander
Controls DocumentViewer
Controls FlowDocumentReader
Controls GroupBox
Controls GridSplitter
Controls Image
Controls Menu
Controls ScrollBar
Controls Slider
Controls RichTextBox
Controls Border
Controls Buttons

SilverLight Interview Qs

SAP Interview Questions

Oracle Interview Questions

PHP Interview Questions

Ajax Interview Questions

IIS 7.0

OOP Interview Questions

Ruby Interview Questions

Sql Server Interview Questions

Winforms Interview Questions

SharePoint 2007 Questions

Microsoft Crm Questions

Content Model Decorator Content Model Interview Questions & FAQs

Questions and answers for Content Model Decorator Content Model.

20. Content Model Decorator Content Model

    20.1 How do I create a Borderless Window in WPF ?
    20.2 How can I animate a BorderThickness value ?
    20.3 How can I use Event Trigger to control a StoryBoard after it is started ?

20.1 How do I create a Borderless Window in WPF ?

To make the window display without this gray border, you need to set the "ResizeMode" property of the window to 'NoResize'.

[XAML]
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="BorderlessWindow" Height="200" Width="200"
Background="White" WindowStyle="None" ResizeMode="NoResize">
BorderThickness="3" Width="150" Height="150">
Learn WPF!




20.2 How can I animate a BorderThickness value ?

BorderThickness can be animated by using the "ThicknessAnimation" class.

The following example animates the thickness of a border by using the ThicknessAnimation. The example uses the "BorderThickness" property of Border.

[XAML]

<!-- This example shows how to use the ThicknessAnimation to create

an animation on the BorderThickness property of a Border. -->

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >

<StackPanel Orientation="Vertical" HorizontalAlignment="Center">

<Border Background="#99FFFFFF" BorderBrush="#CCCCFF" BorderThickness="1"

Margin="0,60,0,20" Padding="20" >

<Border.Triggers>

<EventTrigger RoutedEvent="Border.Loaded">

<BeginStoryboard>

<Storyboard>

<!-- BorderThickness animates from left=1, right=1, top=1, and bottom=1 to

left=28, right=28, top=14, and bottom=14 over one second. -->

<ThicknessAnimation

Storyboard.TargetProperty="BorderThickness"

Duration="0:0:1.5" FillBehavior="HoldEnd" From="1,1,1,1" To="28,14,28,14" />

</Storyboard>

</BeginStoryboard>

</EventTrigger>

</Border.Triggers>

<TextBlock>

This example shows how to use the ThicknessAnimation to create

an animation on the BorderThickness property of a Border.

</TextBlock>

</Border>

</StackPanel>

</Page>


20.3 How can I use Event Trigger to control a StoryBoard after it is started ?

The following example uses controllable storyboard actions to interactively control a storyboard.

[XAML]

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

WindowTitle="Controlling a Storyboard" >

<StackPanel Margin="20" >

<!-- This rectangle is animated. -->

<Rectangle Name="myRectangle"

Width="100" Height="20" Margin="12,0,0,5" Fill="#AA3333FF" HorizontalAlignment="Left" />

<!-- This StackPanel contains all the Buttons. -->

<StackPanel Orientation="Horizontal" Margin="0,30,0,0">

<Button Name="BeginButton">Begin</Button>

<Button Name="PauseButton">Pause</Button>

<Button Name="ResumeButton">Resume</Button>

<Button Name="SeekButton">Seek</Button>

<Button Name="SkipToFillButton">Skip To Fill</Button>

<Button Name="SetSpeedRatioButton">Triple Speed</Button>

<Button Name="StopButton">Stop</Button>

<StackPanel.Triggers>

<!-- Begin the Storyboard -->

<EventTrigger RoutedEvent="Button.Click" SourceName="BeginButton">

<BeginStoryboard Name="MyBeginStoryboard">

<Storyboard >

<DoubleAnimation

Storyboard.TargetName="myRectangle"

Storyboard.TargetProperty="Width"

Duration="0:0:5" From="100" To="500" />

</Storyboard>

</BeginStoryboard>

</EventTrigger>

<!-- Pause the Storyboard -->

<EventTrigger RoutedEvent="Button.Click" SourceName="PauseButton">

<PauseStoryboard BeginStoryboardName="MyBeginStoryboard" />

</EventTrigger>

<!-- Resume the Storyboard -->

<EventTrigger RoutedEvent="Button.Click" SourceName="ResumeButton">

<ResumeStoryboard BeginStoryboardName="MyBeginStoryboard" />

</EventTrigger>

<!-- Seek one second into the storyboard's active period. -->

<EventTrigger RoutedEvent="Button.Click" SourceName="SeekButton">

<SeekStoryboard

BeginStoryboardName="MyBeginStoryboard"

Offset="0:0:1" Origin="BeginTime" />

</EventTrigger>

<!-- Skip to Fill -->

<EventTrigger RoutedEvent="Button.Click" SourceName="SkipToFillButton">

<SkipStoryboardToFill BeginStoryboardName="MyBeginStoryboard" />

</EventTrigger>

<!-- Stop the Storyboard -->

<EventTrigger RoutedEvent="Button.Click" SourceName="StopButton">

<StopStoryboard BeginStoryboardName="MyBeginStoryboard" />

</EventTrigger>

<!-- Triple the speed of the Storyboard -->

<EventTrigger RoutedEvent="Button.Click" SourceName="SetSpeedRatioButton">

<SetStoryboardSpeedRatio SpeedRatio="3" BeginStoryboardName="MyBeginStoryboard" />

</EventTrigger>

</StackPanel.Triggers>

</StackPanel>

</StackPanel>

</Page>

bottom user control
::  Home :: Services ::  Prices ::  Request Quote
Copyright 2007, Megasolutions Ltd