Showing posts with label Transform. Show all posts
Showing posts with label Transform. Show all posts

Thursday, March 12, 2009

WPF rendering steps

Here explains the rendering pipeline of WPF visual objects.
If we take a Visual object in WPF ,the rendering takes place as follows
  1. Render all children.
  2. Process OpacityMask.
  3. Process Opacity
  4. BitmapEffect
  5. Clip geometry
  6. GuidelineSet
  7. Transforms

More details here

Tuesday, September 25, 2007

Implementing Microsoft Office 2007 style zooming in WPF

This is a small code snippet which describes about implementing zooming action which is there in most of the components (MS Word 2007 etc) of Office 2007 package.

Basic idea is to put our content in a container and apply scale transform through LayoutTransform based on a slider value.

<Window x:Class="UntitledProject3.Window2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="UntitledProject3" Height="300" Width="300"
>
<StackPanel>
<ScrollViewer Height="100" x:Name="scrl" HorizontalScrollBarVisibility="Auto" Background="{x:Null}" >
<TextBlock Height="19" Margin="0,0,0,0" x:Name="label1" Text ="This is our content">
<TextBlock.LayoutTransform>
<TransformGroup>
<ScaleTransform ScaleX="{Binding Path=Value, ElementName=Slider, Mode=Default}"
ScaleY="{Binding Path=Value, ElementName=Slider, Mode=Default}"/>
</TransformGroup>
</TextBlock.LayoutTransform>
</TextBlock>
</ScrollViewer>
<Slider Value="1" Minimum="1" Maximum="10" x:Name="Slider" />
</StackPanel>
</Window>