:: 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

Graphics and Multimedia Rendering Graphics Interview Questions & FAQs

Questions and answers for Graphics and Multimedia Rendering Graphics.
 

26. Graphics and Multimedia Rendering Graphics

    26.1 How can I create a combine hard and soft shadow ?
    26.2 How can I use a DoubleAnimation to rotate the textblock ?
    26.3 What is the order in which the controls are rendered ?
    26.4 How do I enumerate child objects in a visual tree ?
    26.5 How rendering in WPF differs from WIN32 applications?

26.1 How can I create a combine hard and soft shadow ?

This can be done as follows.

[XAML]

<!-- Hard shadow on top of soft shadow. -->

<TextBlock

Text="Shadow Text"

Foreground="CornflowerBlue">

<TextBlock.BitmapEffect>

<BitmapEffectGroup>

<BitmapEffectGroup.Children>

<DropShadowBitmapEffect

ShadowDepth="5"

Direction="330"

Color="DarkSlateBlue"

Opacity="0.75"

Softness="0.50" />

 

<DropShadowBitmapEffect

ShadowDepth="2"

Direction="330"

Color="Maroon"

Opacity="0.5"

Softness="0.0" />

</BitmapEffectGroup.Children>

</BitmapEffectGroup>

</TextBlock.BitmapEffect>

</TextBlock>


26.2 How can I use a DoubleAnimation to rotate the textblock ?

The following example uses a DoubleAnimation to rotate the textblock. The textblock performs a full rotation over a duration of 20 seconds and then continues to repeat the rotation.

[XAML]

<TextBlock

Name="MyRotatingText"

Margin="20"

Width="640" Height="100" FontSize="48" FontWeight="Bold" Foreground="Teal"

> 

This is rotating text

<TextBlock.RenderTransform>

<RotateTransform x:Name="MyRotateTransform" Angle="0" CenterX="230" CenterY="25"/>

</TextBlock.RenderTransform>

<!-- Animates the text block's rotation. -->

<TextBlock.Triggers>

<EventTrigger RoutedEvent="TextBlock.Loaded">

<BeginStoryboard>

<Storyboard>

<DoubleAnimation

Storyboard.TargetName="MyRotateTransform"

Storyboard.TargetProperty="(RotateTransform.Angle)"

From="0.0" To="360" Duration="0:0:10"

RepeatBehavior="Forever" />

</Storyboard>

</BeginStoryboard>

</EventTrigger>

</TextBlock.Triggers>

</TextBlock>


26.3 What is the order in which the controls are rendered ?

The visual tree determines the rendering order of WPF visual and drawing objects. The root of the visual tree is first rendered and then it's child visual objects are traversed from left to right. If the visual object contains a child object then it's child objects are traversed before the visual object's siblings are traversed.


26.4 How do I enumerate child objects in a visual tree ?

We can define three paragraphs under one section as follows.

In the following example, the section has a "Background" property value of Red, therefore the background color of the paragraphs is also red.

[XAML]

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

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

<!-- By default, Section applies no formatting to elements contained

within it. However, in this example, the section has a Background

property value of "Red", therefore, the three paragraphs (the block)

inside the section also have a red background. -->

<Section Background="Red">

<Paragraph>

Paragraph 1

</Paragraph>

<Paragraph>

Paragraph 2

</Paragraph>

<Paragraph>

Paragraph 3

</Paragraph>

</Section>

</FlowDocument>


26.5 How rendering in WPF differs from WIN32 applications?

A WIN32 application uses immediate mode graphics system wherein the application is responsible for repainting the client area when they are resized or the object's visual appearance is changed. WPF on the contrary uses retained mode graphics system. In this mode, drawing information of an object is persisted and serialized by the application and the rendering is done by the system.

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