WPF中设置button边框为透明 <Button BorderBrush="Transparent"><Button.Background> <ImageBrush ImageSoure="..."/></Button.Background></Button> 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <Style x:Key="btnStyle" TargetType="{x:Type Button}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Grid> <Image Height="{TemplateBinding Height}" Width="{TemplateBinding Width}" Source="{TemplateBinding Content}" Stretch="Fill"> </Image> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style><Button Style="{StaticResource btnStyle}" Content="图片路径" /> <Style x:Key="btnStyle" TargetType="{x:Type Button}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Grid> <Image Height="{TemplateBinding Height}" Width="{TemplateBinding Width}" Source="{TemplateBinding Content}" Stretch="Fill"> </Image> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style><Button Style="{StaticResource btnStyle}" Content="图片路径" Height="100" Width="100" /> http://nonocast.cn/button-in-wpf2/要重写 template <style x:key="abc" TargetType="Button"><Setter Property="Control.Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border x:Name="Chrome" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true"> <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> </Border> </ControlTemplate> </Setter.Value> </Setter></style><button Name = "Button1" style={StaticResource abc} /> 谁能给我讲讲冒泡排序的原理 新手求救!!!!!!! 如何用base64加密.zip文件,生成一串字符串? 使用三层开发时,两个连续的添加,如果第二个出现错误,如何使第一个回滚呢? 如何上传个人网站 菜鸟请教:C#如何打开一个网页,并取得网页的文本、href链接、图片的src? 线程问题 看看那些高手们看过这样的代码。 字典嵌套字典的用法好吗? 《C#如何开发气象数据处理软件》. 小弟我正在开发一个WPF项目,遇到一个难题,求各位大神指导我一下…… 求推荐,C#和.NET提高方面好书。
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Grid>
<Image Height="{TemplateBinding Height}" Width="{TemplateBinding Width}" Source="{TemplateBinding Content}" Stretch="Fill">
</Image>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style><Button Style="{StaticResource btnStyle}" Content="图片路径" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Grid>
<Image Height="{TemplateBinding Height}" Width="{TemplateBinding Width}" Source="{TemplateBinding Content}" Stretch="Fill">
</Image>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Button Style="{StaticResource btnStyle}" Content="图片路径" Height="100" Width="100" />
http://nonocast.cn/button-in-wpf2/
要重写 template
<style x:key="abc" TargetType="Button">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="Chrome" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</style><button Name = "Button1" style={StaticResource abc} />