<Windowx:class= "Wpfapplication9.mainwindow"xmlns= "Http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x= "Http://schemas.microsoft.com/winfx/2006/xaml"Title= "MainWindow"Height= " the"Width= "525"> <window.resources> <Stylex:key= "Newfolderbuttonstyle"TargetType="{x:type Button}"> <Setter Property= "Template"> <Setter.value> <ControlTemplateTargetType="{x:type Button}"> <Gridx:name= "Contentcontainer"> <!--Set Background - <ImageName= "IMG_BK"Stretch= "Fill"Source= "Image/2.png"/> <ImageStretch= "None"Margin= "5"Source= "/wpfapplication9;component/image/fold.png"VerticalAlignment= "Center"HorizontalAlignment= "Left"></Image> <TextBlockMargin= "0 0 0"VerticalAlignment= "Center"HorizontalAlignment= "Center">New Folder</TextBlock> </Grid> <controltemplate.triggers> <Trigger Property= "IsMouseOver"Value= "true"> <Setter Property= "Source"TargetName= "IMG_BK"Value= "Image/1.png"/> </Trigger> <Trigger Property= "IsPressed"Value= "true"> <Setter Property= "Source"TargetName= "IMG_BK"Value= "Image/1.png"/> </Trigger> </controltemplate.triggers> </ControlTemplate> </Setter.value> </Setter> </Style> </window.resources> <Grid> <ButtonForeground= "Black"Height= "+"HorizontalAlignment= "Left"Margin= "141,174,0,0"Name= "Button1"VerticalAlignment= "Top"Width= "the"Style="{DynamicResource Newfolderbuttonstyle}"/> </Grid></Window>
Button Trigger Style