Mega Code Archive

 
Categories / C# / WPF
 

Button with Image source

<Window x:Class="OpacityMaskExample"   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title=""   Height="430" Width="300">   <Grid>        <Button Name="Select" ToolTip="Select" Margin="5" Width="60" Height="60" Background="LightCoral">           <Image Width="50" Height="50">             <Image.Source>               <DrawingImage>                 <DrawingImage.Drawing>                   <GeometryDrawing Brush="Yellow">                     <GeometryDrawing.Geometry>                       <PathGeometry                         Figures="M25,75 L 50,0 200,75 100,75 60,100 40,100,40,75Z">                         <PathGeometry.Transform>                           <RotateTransform                             CenterX="50" CenterY="50" Angle="45" />                         </PathGeometry.Transform>                       </PathGeometry>                     </GeometryDrawing.Geometry>                     <GeometryDrawing.Pen>                       <Pen Brush="Gray"                         Thickness="3" />                     </GeometryDrawing.Pen>                   </GeometryDrawing>                 </DrawingImage.Drawing>               </DrawingImage>             </Image.Source>           </Image>         </Button>   </Grid> </Window>