![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
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.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| 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 Specs![]() |
| | #2 (permalink) |
| 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 Specs![]() |
| | #3 (permalink) |
| 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 Specs![]() |
| | #4 (permalink) |
| 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 Specs![]() |
![]() |
| 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 |