July 2015
Intermediate to advanced
1300 pages
87h 27m
English
You can fill a visual element with an image file by using the ImageBrush brush. This object is useful even if you want to fill text with image textures. The following code snippet shows how to apply an ImageBrush as a button background and as the text foreground color:
<StackPanel Grid.Row="3" Orientation="Horizontal"> <Button Width="100" Margin="5" Content="Hello!" Foreground="Yellow"> <Button.Background> <ImageBrush Opacity="0.5" ImageSource= "/StylesBrushesTemplatesAnimations;component/Images/Avatar.jpg" /> </Button.Background> </Button> <TextBlock Margin="5" FontFamily="Segoe UI" FontSize="40" Text="Hello!"