2012-11-06 89 views
2

我想在Windows 8的應用程序中使用一些國家/地區的形狀自定義按鈕,我已將路徑作爲按鈕內容。我遇到的問題是將鼠標懸停在按鈕上,我在圖像中有這個方形邊緣(板),我想在鏈接中做像第三個圖像的東西。任何人有任何想法如何做到這一點?我接受所有可能的想法,謝謝大家的關注。作爲按鈕的自定義形狀Windows 8

https://skydrive.live.com/redir?resid=FB358590F3727A63!183&authkey=!AHwzOa2dQPSj338

回答

0

嘗試做

<Style x:Key="BasicRichTextStyle" TargetType="RichTextBlock"> 
    <Setter Property="Foreground" Value="{StaticResource ApplicationForegroundThemeBrush}"/> 
    <Setter Property="FontSize" Value="{StaticResource ControlContentThemeFontSize}"/> 
    <Setter Property="FontFamily" Value="{StaticResource ContentControlThemeFontFamily}"/> 
    <Setter Property="TextTrimming" Value="WordEllipsis"/> 
    <Setter Property="TextWrapping" Value="Wrap"/> 
    <Setter Property="Typography.StylisticSet20" Value="True"/> 
    <Setter Property="Typography.DiscretionaryLigatures" Value="True"/> 
    <Setter Property="Typography.CaseSensitiveForms" Value="True"/> 
</Style> 

和u可以使用visualstatemanager爲哈弗財產我這樣

0

認爲雖然造型的邊框的按鈕檢查設置屬性這是包裝內容主持人。嘗試更改PointOver Viewstate上的邊框顏色或厚度屬性,或者如果您完全不需要它,則可以完全刪除像這樣的所有狀態的邊框厚度,

<Style x:Key="ButtonStyle1" TargetType="Button"> 
     <Setter Property="Background" Value="{StaticResource ButtonBackgroundThemeBrush}"/> 
     <Setter Property="Foreground" Value="{StaticResource ButtonForegroundThemeBrush}"/> 
     <Setter Property="BorderBrush" Value="{StaticResource ButtonBorderThemeBrush}"/> 
     <Setter Property="BorderThickness" Value="{StaticResource ButtonBorderThemeThickness}"/> 
     <Setter Property="Padding" Value="12,4,12,4"/> 
     <Setter Property="HorizontalAlignment" Value="Left"/> 
     <Setter Property="VerticalAlignment" Value="Center"/> 
     <Setter Property="FontFamily" Value="{StaticResource ContentControlThemeFontFamily}"/> 
     <Setter Property="FontWeight" Value="SemiBold"/> 
     <Setter Property="FontSize" Value="{StaticResource ControlContentThemeFontSize}"/> 
     <Setter Property="Template"> 
      <Setter.Value> 
       <ControlTemplate TargetType="Button"> 
        <Grid> 
         <VisualStateManager.VisualStateGroups> 
          <VisualStateGroup x:Name="CommonStates"> 
           <VisualState x:Name="Normal"/> 
           <VisualState x:Name="PointerOver"> 
            <Storyboard> 
             <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="Border"> 
              <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonPointerOverBackgroundThemeBrush}"/> 
             </ObjectAnimationUsingKeyFrames> 
             <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter"> 
              <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonPointerOverForegroundThemeBrush}"/> 
             </ObjectAnimationUsingKeyFrames> 
            </Storyboard> 
           </VisualState> 
           <VisualState x:Name="Pressed"> 
            <Storyboard> 
             <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="Border"> 
              <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonPressedBackgroundThemeBrush}"/> 
             </ObjectAnimationUsingKeyFrames> 
             <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter"> 
              <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonPressedForegroundThemeBrush}"/> 
             </ObjectAnimationUsingKeyFrames> 
            </Storyboard> 
           </VisualState> 
           <VisualState x:Name="Disabled"> 
            <Storyboard> 
             <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="Border"> 
              <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonDisabledBackgroundThemeBrush}"/> 
             </ObjectAnimationUsingKeyFrames> 
             <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter"> 
              <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonDisabledForegroundThemeBrush}"/> 
             </ObjectAnimationUsingKeyFrames> 
            </Storyboard> 
           </VisualState> 
          </VisualStateGroup> 
          <VisualStateGroup x:Name="FocusStates"> 
           <VisualState x:Name="Focused"> 
            <Storyboard> 
             <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="FocusVisualWhite"/> 
             <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="FocusVisualBlack"/> 
            </Storyboard> 
           </VisualState> 
           <VisualState x:Name="Unfocused"/> 
           <VisualState x:Name="PointerFocused"/> 
          </VisualStateGroup> 
         </VisualStateManager.VisualStateGroups> 
         <Border x:Name="Border" Background="{TemplateBinding Background}" Margin="3"> 
          <ContentPresenter x:Name="ContentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTransitions="{TemplateBinding ContentTransitions}" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> 
         </Border> 
         <Rectangle x:Name="FocusVisualWhite" IsHitTestVisible="False" Opacity="0" StrokeDashOffset="1.5" StrokeEndLineCap="Square" Stroke="{StaticResource FocusVisualWhiteStrokeThemeBrush}" StrokeDashArray="1,1"/> 
         <Rectangle x:Name="FocusVisualBlack" IsHitTestVisible="False" Opacity="0" StrokeDashOffset="0.5" StrokeEndLineCap="Square" Stroke="{StaticResource FocusVisualBlackStrokeThemeBrush}" StrokeDashArray="1,1"/> 
        </Grid> 
       </ControlTemplate> 
      </Setter.Value> 
     </Setter> 
    </Style>