Windows Vista Forums
Vista Forums Home Join Vista Forums Webcasts Windows 7 Forum Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

ImageBrush TileMode not working?

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 01-10-2006   #1 (permalink)
Corrado Cavalli [MVP]
Guest


 

ImageBrush TileMode not working?

I have following markup

<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
<ColumnDefinition/>

</Grid.ColumnDefinitions>
<Rectangle Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3">
<Rectangle.Fill>
<ImageBrush ImageSource="\Resources\ferrari.jpg" Stretch="Uniform"
TileMode="Tile"/>
</Rectangle.Fill>
</Rectangle>
</Grid>

But can't see image tiled, it just appears centered...
Am i missing something?


--
Corrado Cavalli [Microsoft .NET MVP-MCP]
UGIdotNET - http://www.ugidotnet.org
Weblog: http://blogs.ugidotnet.org/corrado




My System SpecsSystem Spec
Old 01-10-2006   #2 (permalink)
Adam Smith [MS]
Guest


 

Re: ImageBrush TileMode not working?

By default, the Viewport for a TileBrush is 0,0,1,1 and the ViewportUnits
are RelativeToBoundingBox, meaning that 0,0,1,1 maps to the entire
destination size (in this case, the bounds of the Rectangle Element). When
tiling a TileBrush, it's the Viewport which is repeated, so since one
Viewport is taking up the entire destination size, you won't see a different
between and of the different TileModes. If you were to set the Viewport to
0,0,.5,.5, you should see 2 x 2 (since each tile will be 50%x50% the size of
the Rectangle), or 0,0,0.25,0.1 would produce a 4x10 tiling, etc.

-Adam Smith [MS]


"Corrado Cavalli [MVP]" <corradoNOSPAMPLEASE@mvps.org> wrote in message
news:40akmmF191k8cU1@individual.net...
>I have following markup
>
> <Grid>
> <Grid.RowDefinitions>
> <RowDefinition/>
> <RowDefinition/>
> </Grid.RowDefinitions>
> <Grid.ColumnDefinitions>
> <ColumnDefinition Width="Auto"/>
> <ColumnDefinition/>
> <ColumnDefinition/>
>
> </Grid.ColumnDefinitions>
> <Rectangle Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3">
> <Rectangle.Fill>
> <ImageBrush ImageSource="\Resources\ferrari.jpg" Stretch="Uniform"
> TileMode="Tile"/>
> </Rectangle.Fill>
> </Rectangle>
> </Grid>
>
> But can't see image tiled, it just appears centered...
> Am i missing something?
>
>
> --
> Corrado Cavalli [Microsoft .NET MVP-MCP]
> UGIdotNET - http://www.ugidotnet.org
> Weblog: http://blogs.ugidotnet.org/corrado
>
>
>



My System SpecsSystem Spec
Old 01-10-2006   #3 (permalink)
craig kelly-soens www.XpectWorld.com
Guest


 

RE: ImageBrush TileMode not working?

hi,

I had this, i did a post but no-one answered but i figured it out in the end
myself.

If you see the rotating 360o image in the top of example below using the
<ImageBrush feature from Sept05 ctp in

C:\Program Files\Microsoft
SDKs\WinFX\samples\Allsamples\WPF\GraphicsMM_Brushes\UsingImageBrush\XAML\InteractiveExample.xaml

i used this to tile and 360 rotate a fairly small logo for the XAML client i
was working for, now in CTP sept 05 the same markup is just a column not
what i would call a tile ? I believe this is what you have also.

You will also notice that if u do a TileMode="Tile" and *dont* specify
Stretch="None" it tiles it as it did before,
but obviously the image is too "FAT" as it is stretched.

to make it look like it was with sep05 and to solve your problem, i now need
to specify viewport ?
(Viewport="0,0,70,70" ViewportUnits="Absolute")

here is the altered XAML based on nov05 CTP sample

<!-- for Animated image header -->
<Style x:Key="myAnimatedRectangleStyle">
<Style.Triggers>
<EventTrigger RoutedEvent="Rectangle.Loaded">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard SpeedRatio="0.20">
<RectAnimation To="0,0,0.5,0.5" Duration="0:0:50"
RepeatBehavior="Forever" AutoReverse="True"
Storyboard.TargetProperty="(Rectangle.Fill).(ImageBrush.Viewport)" />
<DoubleAnimation To="360" Duration="0:0:50" RepeatBehavior="Forever"
AccelerationRatio="0.5" DecelerationRatio="0.5"

Storyboard.TargetProperty="(Rectangle.Fill).(ImageBrush.Transform).(RotateTransform.Angle)" />
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Style.Triggers>
<!-- this is for the Animated image header -->
<Setter Property="Rectangle.Fill">
<Setter.Value>
<ImageBrush ImageSource="images\CompanyLogo.jpg"
Viewport="0,0,70,70" ViewportUnits="Absolute"
Opacity="0.3" TileMode="Tile" >
<ImageBrush.Transform>
<RotateTransform Angle="0" />
</ImageBrush.Transform>
</ImageBrush>
</Setter.Value>
</Setter>
</Style>

craig kelly-soens - Windows Vista WinFx XAML .Net Evangelist
http://www.XpectWorld.com - customised "super-easy to use" Windows Vista
based software & consultancy
My System SpecsSystem Spec
Old 01-10-2006   #4 (permalink)
Corrado Cavalli [MVP]
Guest


 

Re: ImageBrush TileMode not working?

Thanks Adam.


--
Corrado Cavalli [Microsoft .NET MVP-MCP]
UGIdotNET - http://www.ugidotnet.org
Weblog: http://blogs.ugidotnet.org/corrado



My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Binding an ImageBrush Problem star-italia .NET General 5 06-13-2008 02:36 AM
Creating an BitmapImage from an ImageBrush? scott.browse@gmail.com Avalon 0 08-13-2007 05:46 PM
ImageBrush & 3D John Avalon 1 10-24-2006 11:01 AM
ImageBrush Bugs? HolaMan Avalon 3 04-17-2006 11:26 AM
ImageBrush Tiling Kevin Hoffman Avalon 2 03-03-2006 10:26 PM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51