画像があり、枠線のないボタンを作成しようとしています。Firefoxのツールバーのボタンにカーソルを合わせて完全なボタンを表示する前と同じです。
BorderBrushto Transparent、BorderThicknessto 0、およびを設定してみましたが、BorderBrush="{x:Null}"まだボタンの概要を確認できます。
画像があり、枠線のないボタンを作成しようとしています。Firefoxのツールバーのボタンにカーソルを合わせて完全なボタンを表示する前と同じです。
BorderBrushto Transparent、BorderThicknessto 0、およびを設定してみましたが、BorderBrush="{x:Null}"まだボタンの概要を確認できます。
回答:
これを試して
<Button BorderThickness="0"  
    Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" >...HorizontalContentAlignmentした効果を無効にしますStretch。
                    ボタンテンプレートを変更する必要がある場合があります。これにより、フレームがまったくないボタンが表示されますが、プレスや無効化されたエフェクトはありません。
    <Style x:Key="TransparentStyle" TargetType="{x:Type Button}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Border Background="Transparent">
                        <ContentPresenter/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>そしてボタン:
<Button Style="{StaticResource TransparentStyle}"/><Button Style="{StaticResource TransparentButton}"/>する必要があります<Button Style="{StaticResource TransparentStyle}"/>
                    あなたがしなければならないことは次のようなものです:
<Button Name="MyFlatImageButton"
        Background="Transparent"
        BorderBrush="Transparent"
        BorderThickness="0" 
        Padding="-4">
   <Image Source="MyImage.png"/>
</Button>これがあなたが探していたものであることを願っています。
編集:申し訳ありませんが、画像にカーソルを合わせたときにボタンの境界線を表示したい場合は、Padding = "-4"をスキップするだけです。
他の人がこの質問が受け入れられた答えのあるこの質問と重複していることを指摘しなかった理由がわかりません。
私はここで解決策を引用:あなたがオーバーライドする必要があるControlTemplateのをButton:
<Button Content="save" Name="btnSaveEditedText" 
                Background="Transparent" 
                Foreground="White" 
                FontFamily="Tw Cen MT Condensed" 
                FontSize="30" 
                Margin="-280,0,0,10"
                Width="60"
                BorderBrush="Transparent"
                BorderThickness="0">
    <Button.Template>
        <ControlTemplate TargetType="Button">
             <ContentPresenter Content="{TemplateBinding Content}"/>
        </ControlTemplate>
    </Button.Template>  
</Button>次のように、ボタンの代わりにハイパーリンクを使用できます。
        <TextBlock>
            <Hyperlink TextDecorations="{x:Null}">
            <Image Width="16"
                   Height="16"
                   Margin="3"
                   Source="/YourProjectName;component/Images/close-small.png" />
            </Hyperlink>
        </TextBlock>プログラムでこれを行うことができます:
btn.BorderBrush = new SolidColorBrush(Colors.Transparent);Background & BorderBrush一緒に設定してみませんかbrush
 <Style TargetType="{x:Type Button}" >
        <Setter Property="Background" Value="{StaticResource marginBackGround}"></Setter>
        <Setter Property="BorderBrush" Value="{StaticResource marginBackGround}"></Setter>            
 </Style>
<LinearGradientBrush  x:Key="marginBackGround" EndPoint=".5,1" StartPoint="0.5,0">
    <GradientStop Color="#EE82EE" Offset="0"/>
    <GradientStop Color="#7B30B6" Offset="0.5"/>
    <GradientStop Color="#510088" Offset="0.5"/>
    <GradientStop Color="#76209B" Offset="0.9"/>
    <GradientStop Color="#C750B9" Offset="1"/>
</LinearGradientBrush>