2016-03-20 14 views

答えて

1

はい、コントロールのStyleをニーズに合わせて変更できます。

<Style x:Key="TextBox.Ellipse" TargetType="{x:Type TextBox}"> 
     <!--Here you can set the default properties of this style.--> 
     <Setter Property="FontWeight" Value="Bold"/> 

     <!--You can change the shape of the control by setting the template--> 
     <Setter Property="Template"> 
      <Setter.Value> 
       <ControlTemplate TargetType="{x:Type TextBox}"> 
        <Grid> 
         <Ellipse x:Name="Border" Stroke="#FF393785" StrokeThickness="2"> 
          <Ellipse.Fill> 
           <RadialGradientBrush GradientOrigin="0.25,0.25" 
                RadiusY="0.75" RadiusX="0.75"> 
            <GradientStop Color="White" Offset="0.2"/> 
            <GradientStop Color="#FF2EC452" Offset="0.5"/> 
            <GradientStop Color="#FF606060" Offset="1"/> 
           </RadialGradientBrush> 
          </Ellipse.Fill> 
          </Ellipse>        
         <!-- The implementation places the Content into the ScrollViewer. 
          It must be named PART_ContentHost 
          for the control to function --> 
         <ScrollViewer x:Name="PART_ContentHost" Background="Transparent" 
          HorizontalAlignment="Center" VerticalAlignment="Center"/> 
        </Grid> 
        <ControlTemplate.Triggers> 
         <Trigger Property="IsEnabled" Value="False"> 
          <Setter Property="Fill" Value="#000" TargetName="Border"/> 
         </Trigger> 
        </ControlTemplate.Triggers> 
       </ControlTemplate> 
      </Setter.Value> 
     </Setter> 
    </Style> 

その後、あなたはこのようなTextBoxのスタイルを設定することができます
など、App.Xamlなどのリソースディクショナリ内のこのStyleを置く:

<TextBox Style="{StaticResource TextBox.Ellipse}" /> 
関連する問題