如何在Xamarin UWP中创建一个带有圆角边框的输入框和编辑器。

huangapple go评论75阅读模式
英文:

How to create a rounded border entry and editor in Xamarin UWP

问题

你好,我有一个Xamarin UWP应用程序,想要对所有输入控件应用圆角。我尝试了以下步骤来使输入框具有圆角边框,但没有成功。请帮帮我。我也想对选择器和编辑器实现相同效果。

[assembly:ExportRenderer(typeof(Entry),typeof(RoundedEntry))]
namespace combo.UWP
{
  public class RoundedEntry:EntryRenderer
  {
     protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
     {
        base.OnElementChanged(e);
        if(Control!= null)
        {
            Control.BorderThickness = new Windows.UI.Xaml.Thickness(1);
            Control.BorderBrush = Windows.UI.Xaml.Application.Current.Resources["borderBrush"] as Windows.UI.Xaml.Media.Brush;
            Control.CornerRadius = new Windows.UI.Xaml.CornerRadius(100);
        }
    }
  }
}
英文:

Hi I have a Xamarin UWP application, and want to apply corner radius to all the input controls. I tried the below steps to make entry rounded border but it didn't work. Please help me . I want to implement the same for picker and editor too.

[assembly:ExportRenderer(typeof(Entry),typeof(RoundedEntry))]
 namespace combo.UWP
 {
  public class RoundedEntry:EntryRenderer
   {
     protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
     {
        base.OnElementChanged(e);
        if(Control!= null)
        {
            Control.BorderThickness = new Windows.UI.Xaml.Thickness(1);
            Control.BorderBrush = Windows.UI.Xaml.Application.Current.Resources["borderBrush"] as Windows.UI.Xaml.Media.Brush;
            Control.CornerRadius = new Windows.UI.Xaml.CornerRadius(100);
           // Control.BorderBrush=Windows.UI.Xaml.
        }
    }
}

}

答案1

得分: 0

以下是您提供的内容的中文翻译:

是的,您可以使用自定义渲染器来实现这一点。

请按照以下步骤进行操作:

  1. 在表单中自定义控件 RoundedEditor
public class RoundedEditor : Editor
{
    // 空的或定义您的自定义字段
}
  1. 通过右键单击项目->添加->新建项->资源字典 来创建一个 ResourceDictionary 文件,将其重命名为 RoundedEditorRes.xaml 并将完整的 TextBox 默认样式 添加到资源字典中。

  2. 编辑 TextBox 的默认样式中的 Border 元素(添加 CornerRadius="15",并将 BorderThickness="{TemplateBinding BorderThickness}" 更改为 BorderThickness="2"),并为样式添加一个键:

<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:RoundedEditorDemo.UWP">
    ...
    <Border 
         CornerRadius="15"
         BorderThickness="2"
         x:Name="BorderElement" 
         BorderBrush="{TemplateBinding BorderBrush}" 
         Background="{TemplateBinding Background}" 
         Grid.ColumnSpan="2" Grid.Row="1" Grid.RowSpan="1"/>
    ...
</ResourceDictionary>
  1. 创建您的自定义渲染器:
[assembly: ExportRenderer(typeof(RoundedEditor), typeof(RoundedEditorRenderer))]
namespace RoundedEditorDemo.UWP
{
    public class RoundedEditorRenderer : EditorRenderer
    {
        protected override void OnElementChanged(ElementChangedEventArgs<Editor> e)
        {
            base.OnElementChanged(e);
            if (Control != null)
            {
                Windows.UI.Xaml.ResourceDictionary dic = new Windows.UI.Xaml.ResourceDictionary();
                dic.Source = new Uri("ms-appx:///RoundedEditorRes.xaml");
                Control.Style = dic["RoundedEditorStyle"] as Windows.UI.Xaml.Style;
            }
        }
    }
}

注意:

您可以在此处参考 RoundedEditorRes.xaml 的完整代码:

<ResourceDictionary 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:RoundedEditorDemo.UWP">
    <Style x:Key="RoundedEditorStyle" TargetType="TextBox">
        ...
        <!-- 样式的其余部分 -->
        ...
    </Style>
</ResourceDictionary>
英文:

Yes,you can use Custom Renderer to achieve this.

Please follow up the following steps:

1.Custom Control RoundedEditor in form

public class RoundedEditor:Editor
{
  //empty or define your custom fields
}

2.Create a ResourceDictionary file by right click your project->Add->New Item->Resource Dictionary->rename to RoundedEditorRes.xaml and add the full TextBox default style to the resource dictionary.

3.Edit the Border element(add CornerRadius=&quot;15&quot; and change BorderThickness=&quot;{TemplateBinding BorderThickness}&quot; to BorderThickness=&quot;2&quot; ) of the TextBox's default style and add a key to the style:

   &lt;ResourceDictionary
xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot; 
xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
xmlns:local=&quot;using:RoundedEditorDemo.UWP&quot;&gt;
    ...
    &lt;Border 
         CornerRadius=&quot;15&quot;
         BorderThickness=&quot;2&quot;
         x:Name=&quot;BorderElement&quot; 
         BorderBrush=&quot;{TemplateBinding BorderBrush}&quot; 
         Background=&quot;{TemplateBinding Background}&quot; 
         Grid.ColumnSpan=&quot;2&quot; Grid.Row=&quot;1&quot; Grid.RowSpan=&quot;1&quot;/&gt;
    ...
&lt;/ResourceDictionary&gt;

4.Create your Custom Renderer:

  [assembly: ExportRenderer(typeof(RoundedEditor), 
typeof(RoundedEditorRenderer))]
namespace RoundedEditorDemo.UWP
{
    public class RoundedEditorRenderer:EditorRenderer
    {
        protected override void OnElementChanged(ElementChangedEventArgs&lt;Editor&gt; e)
        {
            base.OnElementChanged(e);
            if (Control != null)
            {
                Windows.UI.Xaml.ResourceDictionary dic = new Windows.UI.Xaml.ResourceDictionary();
                dic.Source = new Uri(&quot;ms-appx:///RoundedEditorRes.xaml&quot;);
                Control.Style = dic[&quot;RoundedEditorStyle&quot;] as Windows.UI.Xaml.Style;
            }
        }
    }
}

Note:

You can refer to the full code of RoundedEditorRes.xaml here:

&lt;ResourceDictionary 
xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot; 
xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
xmlns:local=&quot;using:RoundedEditorDemo.UWP&quot;&gt;
&lt;Style x:Key=&quot;RoundedEditorStyle&quot; TargetType=&quot;TextBox&quot;&gt;
&lt;Setter Property=&quot;MinWidth&quot; Value=&quot;{ThemeResource TextControlThemeMinWidth}&quot;/&gt;
&lt;Setter Property=&quot;MinHeight&quot; Value=&quot;{ThemeResource TextControlThemeMinHeight}&quot;/&gt;
&lt;Setter Property=&quot;Foreground&quot; Value=&quot;{ThemeResource TextControlForeground}&quot;/&gt;
&lt;Setter Property=&quot;Background&quot; Value=&quot;{ThemeResource TextControlBackground}&quot;/&gt;
&lt;Setter Property=&quot;BorderBrush&quot; Value=&quot;{ThemeResource TextControlBorderBrush}&quot;/&gt;
&lt;Setter Property=&quot;SelectionHighlightColor&quot; Value=&quot;{ThemeResource TextControlSelectionHighlightColor}&quot;/&gt;
&lt;Setter Property=&quot;BorderThickness&quot; Value=&quot;{ThemeResource TextControlBorderThemeThickness}&quot;/&gt;
&lt;Setter Property=&quot;FontFamily&quot; Value=&quot;{ThemeResource ContentControlThemeFontFamily}&quot;/&gt;
&lt;Setter Property=&quot;FontSize&quot; Value=&quot;{ThemeResource ControlContentThemeFontSize}&quot;/&gt;
&lt;Setter Property=&quot;ScrollViewer.HorizontalScrollMode&quot; Value=&quot;Auto&quot;/&gt;
&lt;Setter Property=&quot;ScrollViewer.VerticalScrollMode&quot; Value=&quot;Auto&quot;/&gt;
&lt;Setter Property=&quot;ScrollViewer.HorizontalScrollBarVisibility&quot; Value=&quot;Hidden&quot;/&gt;
&lt;Setter Property=&quot;ScrollViewer.VerticalScrollBarVisibility&quot; Value=&quot;Hidden&quot;/&gt;
&lt;Setter Property=&quot;ScrollViewer.IsDeferredScrollingEnabled&quot; Value=&quot;False&quot;/&gt;
&lt;Setter Property=&quot;Padding&quot; Value=&quot;{ThemeResource TextControlThemePadding}&quot;/&gt;
&lt;Setter Property=&quot;Template&quot;&gt;
&lt;Setter.Value&gt;
&lt;ControlTemplate TargetType=&quot;TextBox&quot;&gt;
&lt;Grid&gt;
&lt;Grid.Resources&gt;
&lt;Style x:Name=&quot;DeleteButtonStyle&quot; TargetType=&quot;Button&quot;&gt;
&lt;Setter Property=&quot;Template&quot;&gt;
&lt;Setter.Value&gt;
&lt;ControlTemplate TargetType=&quot;Button&quot;&gt;
&lt;Grid x:Name=&quot;ButtonLayoutGrid&quot; BorderBrush=&quot;{ThemeResource TextControlButtonBorderBrush}&quot; BorderThickness=&quot;{TemplateBinding BorderThickness}&quot; Background=&quot;{ThemeResource TextControlButtonBackground}&quot;&gt;
&lt;VisualStateManager.VisualStateGroups&gt;
&lt;VisualStateGroup x:Name=&quot;CommonStates&quot;&gt;
&lt;VisualState x:Name=&quot;Normal&quot;/&gt;
&lt;VisualState x:Name=&quot;PointerOver&quot;&gt;
&lt;Storyboard&gt;
&lt;ObjectAnimationUsingKeyFrames Storyboard.TargetProperty=&quot;Background&quot; Storyboard.TargetName=&quot;ButtonLayoutGrid&quot;&gt;
&lt;DiscreteObjectKeyFrame KeyTime=&quot;0&quot; Value=&quot;{ThemeResource TextControlButtonBackgroundPointerOver}&quot;/&gt;
&lt;/ObjectAnimationUsingKeyFrames&gt;
&lt;ObjectAnimationUsingKeyFrames Storyboard.TargetProperty=&quot;BorderBrush&quot; Storyboard.TargetName=&quot;ButtonLayoutGrid&quot;&gt;
&lt;DiscreteObjectKeyFrame KeyTime=&quot;0&quot; Value=&quot;{ThemeResource TextControlButtonBorderBrushPointerOver}&quot;/&gt;
&lt;/ObjectAnimationUsingKeyFrames&gt;
&lt;ObjectAnimationUsingKeyFrames Storyboard.TargetProperty=&quot;Foreground&quot; Storyboard.TargetName=&quot;GlyphElement&quot;&gt;
&lt;DiscreteObjectKeyFrame KeyTime=&quot;0&quot; Value=&quot;{ThemeResource TextControlButtonForegroundPointerOver}&quot;/&gt;
&lt;/ObjectAnimationUsingKeyFrames&gt;
&lt;/Storyboard&gt;
&lt;/VisualState&gt;
&lt;VisualState x:Name=&quot;Pressed&quot;&gt;
&lt;Storyboard&gt;
&lt;ObjectAnimationUsingKeyFrames Storyboard.TargetProperty=&quot;Background&quot; Storyboard.TargetName=&quot;ButtonLayoutGrid&quot;&gt;
&lt;DiscreteObjectKeyFrame KeyTime=&quot;0&quot; Value=&quot;{ThemeResource TextControlButtonBackgroundPressed}&quot;/&gt;
&lt;/ObjectAnimationUsingKeyFrames&gt;
&lt;ObjectAnimationUsingKeyFrames Storyboard.TargetProperty=&quot;BorderBrush&quot; Storyboard.TargetName=&quot;ButtonLayoutGrid&quot;&gt;
&lt;DiscreteObjectKeyFrame KeyTime=&quot;0&quot; Value=&quot;{ThemeResource TextControlButtonBorderBrushPressed}&quot;/&gt;
&lt;/ObjectAnimationUsingKeyFrames&gt;
&lt;ObjectAnimationUsingKeyFrames Storyboard.TargetProperty=&quot;Foreground&quot; Storyboard.TargetName=&quot;GlyphElement&quot;&gt;
&lt;DiscreteObjectKeyFrame KeyTime=&quot;0&quot; Value=&quot;{ThemeResource TextControlButtonForegroundPressed}&quot;/&gt;
&lt;/ObjectAnimationUsingKeyFrames&gt;
&lt;/Storyboard&gt;
&lt;/VisualState&gt;
&lt;VisualState x:Name=&quot;Disabled&quot;&gt;
&lt;Storyboard&gt;
&lt;DoubleAnimation Duration=&quot;0&quot; To=&quot;0&quot; Storyboard.TargetProperty=&quot;Opacity&quot; Storyboard.TargetName=&quot;ButtonLayoutGrid&quot;/&gt;
&lt;/Storyboard&gt;
&lt;/VisualState&gt;
&lt;/VisualStateGroup&gt;
&lt;/VisualStateManager.VisualStateGroups&gt;
&lt;TextBlock x:Name=&quot;GlyphElement&quot; AutomationProperties.AccessibilityView=&quot;Raw&quot; Foreground=&quot;{ThemeResource TextControlButtonForeground}&quot; FontStyle=&quot;Normal&quot; FontSize=&quot;12&quot; FontFamily=&quot;{ThemeResource SymbolThemeFontFamily}&quot; HorizontalAlignment=&quot;Center&quot; Text=&quot;&amp;#xE10A;&quot; VerticalAlignment=&quot;Center&quot;/&gt;
&lt;/Grid&gt;
&lt;/ControlTemplate&gt;
&lt;/Setter.Value&gt;
&lt;/Setter&gt;
&lt;/Style&gt;
&lt;/Grid.Resources&gt;
&lt;Grid.ColumnDefinitions&gt;
&lt;ColumnDefinition Width=&quot;*&quot;/&gt;
&lt;ColumnDefinition Width=&quot;Auto&quot;/&gt;
&lt;/Grid.ColumnDefinitions&gt;
&lt;Grid.RowDefinitions&gt;
&lt;RowDefinition Height=&quot;Auto&quot;/&gt;
&lt;RowDefinition Height=&quot;*&quot;/&gt;
&lt;/Grid.RowDefinitions&gt;
&lt;VisualStateManager.VisualStateGroups&gt;
&lt;VisualStateGroup x:Name=&quot;CommonStates&quot;&gt;
&lt;VisualState x:Name=&quot;Disabled&quot;&gt;
&lt;Storyboard&gt;
&lt;ObjectAnimationUsingKeyFrames Storyboard.TargetProperty=&quot;Foreground&quot; Storyboard.TargetName=&quot;HeaderContentPresenter&quot;&gt;
&lt;DiscreteObjectKeyFrame KeyTime=&quot;0&quot; Value=&quot;{ThemeResource TextControlHeaderForegroundDisabled}&quot;/&gt;
&lt;/ObjectAnimationUsingKeyFrames&gt;
&lt;ObjectAnimationUsingKeyFrames Storyboard.TargetProperty=&quot;Background&quot; Storyboard.TargetName=&quot;BorderElement&quot;&gt;
&lt;DiscreteObjectKeyFrame KeyTime=&quot;0&quot; Value=&quot;{ThemeResource TextControlBackgroundDisabled}&quot;/&gt;
&lt;/ObjectAnimationUsingKeyFrames&gt;
&lt;ObjectAnimationUsingKeyFrames Storyboard.TargetProperty=&quot;BorderBrush&quot; Storyboard.TargetName=&quot;BorderElement&quot;&gt;
&lt;DiscreteObjectKeyFrame KeyTime=&quot;0&quot; Value=&quot;{ThemeResource TextControlBorderBrushDisabled}&quot;/&gt;
&lt;/ObjectAnimationUsingKeyFrames&gt;
&lt;ObjectAnimationUsingKeyFrames Storyboard.TargetProperty=&quot;Foreground&quot; Storyboard.TargetName=&quot;ContentElement&quot;&gt;
&lt;DiscreteObjectKeyFrame KeyTime=&quot;0&quot; Value=&quot;{ThemeResource TextControlForegroundDisabled}&quot;/&gt;
&lt;/ObjectAnimationUsingKeyFrames&gt;
&lt;ObjectAnimationUsingKeyFrames Storyboard.TargetProperty=&quot;Foreground&quot; Storyboard.TargetName=&quot;PlaceholderTextContentPresenter&quot;&gt;
&lt;DiscreteObjectKeyFrame KeyTime=&quot;0&quot; Value=&quot;{ThemeResource TextControlPlaceholderForegroundDisabled}&quot;/&gt;
&lt;/ObjectAnimationUsingKeyFrames&gt;
&lt;/Storyboard&gt;
&lt;/VisualState&gt;
&lt;VisualState x:Name=&quot;Normal&quot;/&gt;
&lt;VisualState x:Name=&quot;PointerOver&quot;&gt;
&lt;Storyboard&gt;
&lt;ObjectAnimationUsingKeyFrames Storyboard.TargetProperty=&quot;BorderBrush&quot; Storyboard.TargetName=&quot;BorderElement&quot;&gt;
&lt;DiscreteObjectKeyFrame KeyTime=&quot;0&quot; Value=&quot;{ThemeResource TextControlBorderBrushPointerOver}&quot;/&gt;
&lt;/ObjectAnimationUsingKeyFrames&gt;
&lt;ObjectAnimationUsingKeyFrames Storyboard.TargetProperty=&quot;Background&quot; Storyboard.TargetName=&quot;BorderElement&quot;&gt;
&lt;DiscreteObjectKeyFrame KeyTime=&quot;0&quot; Value=&quot;{ThemeResource TextControlBackgroundPointerOver}&quot;/&gt;
&lt;/ObjectAnimationUsingKeyFrames&gt;
&lt;ObjectAnimationUsingKeyFrames Storyboard.TargetProperty=&quot;Foreground&quot; Storyboard.TargetName=&quot;PlaceholderTextContentPresenter&quot;&gt;
&lt;DiscreteObjectKeyFrame KeyTime=&quot;0&quot; Value=&quot;{ThemeResource TextControlPlaceholderForegroundPointerOver}&quot;/&gt;
&lt;/ObjectAnimationUsingKeyFrames&gt;
&lt;ObjectAnimationUsingKeyFrames Storyboard.TargetProperty=&quot;Foreground&quot; Storyboard.TargetName=&quot;ContentElement&quot;&gt;
&lt;DiscreteObjectKeyFrame KeyTime=&quot;0&quot; Value=&quot;{ThemeResource TextControlForegroundPointerOver}&quot;/&gt;
&lt;/ObjectAnimationUsingKeyFrames&gt;
&lt;/Storyboard&gt;
&lt;/VisualState&gt;
&lt;VisualState x:Name=&quot;Focused&quot;&gt;
&lt;Storyboard&gt;
&lt;ObjectAnimationUsingKeyFrames Storyboard.TargetProperty=&quot;Foreground&quot; Storyboard.TargetName=&quot;PlaceholderTextContentPresenter&quot;&gt;
&lt;DiscreteObjectKeyFrame KeyTime=&quot;0&quot; Value=&quot;{ThemeResource TextControlPlaceholderForegroundFocused}&quot;/&gt;
&lt;/ObjectAnimationUsingKeyFrames&gt;
&lt;ObjectAnimationUsingKeyFrames Storyboard.TargetProperty=&quot;Background&quot; Storyboard.TargetName=&quot;BorderElement&quot;&gt;
&lt;DiscreteObjectKeyFrame KeyTime=&quot;0&quot; Value=&quot;{ThemeResource TextControlBackgroundFocused}&quot;/&gt;
&lt;/ObjectAnimationUsingKeyFrames&gt;
&lt;ObjectAnimationUsingKeyFrames Storyboard.TargetProperty=&quot;BorderBrush&quot; Storyboard.TargetName=&quot;BorderElement&quot;&gt;
&lt;DiscreteObjectKeyFrame KeyTime=&quot;0&quot; Value=&quot;{ThemeResource TextControlBorderBrushFocused}&quot;/&gt;
&lt;/ObjectAnimationUsingKeyFrames&gt;
&lt;ObjectAnimationUsingKeyFrames Storyboard.TargetProperty=&quot;Foreground&quot; Storyboard.TargetName=&quot;ContentElement&quot;&gt;
&lt;DiscreteObjectKeyFrame KeyTime=&quot;0&quot; Value=&quot;{ThemeResource TextControlForegroundFocused}&quot;/&gt;
&lt;/ObjectAnimationUsingKeyFrames&gt;
&lt;ObjectAnimationUsingKeyFrames Storyboard.TargetProperty=&quot;RequestedTheme&quot; Storyboard.TargetName=&quot;ContentElement&quot;&gt;
&lt;DiscreteObjectKeyFrame KeyTime=&quot;0&quot; Value=&quot;Light&quot;/&gt;
&lt;/ObjectAnimationUsingKeyFrames&gt;
&lt;/Storyboard&gt;
&lt;/VisualState&gt;
&lt;/VisualStateGroup&gt;
&lt;VisualStateGroup x:Name=&quot;ButtonStates&quot;&gt;
&lt;VisualState x:Name=&quot;ButtonVisible&quot;&gt;
&lt;Storyboard&gt;
&lt;ObjectAnimationUsingKeyFrames Storyboard.TargetProperty=&quot;Visibility&quot; Storyboard.TargetName=&quot;DeleteButton&quot;&gt;
&lt;DiscreteObjectKeyFrame KeyTime=&quot;0&quot;&gt;
&lt;DiscreteObjectKeyFrame.Value&gt;
&lt;Visibility&gt;Visible&lt;/Visibility&gt;
&lt;/DiscreteObjectKeyFrame.Value&gt;
&lt;/DiscreteObjectKeyFrame&gt;
&lt;/ObjectAnimationUsingKeyFrames&gt;
&lt;/Storyboard&gt;
&lt;/VisualState&gt;
&lt;VisualState x:Name=&quot;ButtonCollapsed&quot;/&gt;
&lt;/VisualStateGroup&gt;
&lt;/VisualStateManager.VisualStateGroups&gt;
&lt;Border CornerRadius=&quot;15&quot; x:Name=&quot;BorderElement&quot; BorderBrush=&quot;{TemplateBinding BorderBrush}&quot; BorderThickness=&quot;2&quot; Background=&quot;{TemplateBinding Background}&quot; Grid.ColumnSpan=&quot;2&quot; Grid.Row=&quot;1&quot; Grid.RowSpan=&quot;1&quot;/&gt;
&lt;ContentPresenter x:Name=&quot;HeaderContentPresenter&quot; Grid.ColumnSpan=&quot;2&quot; ContentTemplate=&quot;{TemplateBinding HeaderTemplate}&quot; Content=&quot;{TemplateBinding Header}&quot; Foreground=&quot;{ThemeResource TextControlHeaderForeground}&quot; FontWeight=&quot;Normal&quot; Margin=&quot;0,0,0,8&quot; Grid.Row=&quot;0&quot; TextWrapping=&quot;{TemplateBinding TextWrapping}&quot; Visibility=&quot;Collapsed&quot; x:DeferLoadStrategy=&quot;Lazy&quot;/&gt;
&lt;ScrollViewer x:Name=&quot;ContentElement&quot; AutomationProperties.AccessibilityView=&quot;Raw&quot; HorizontalScrollMode=&quot;{TemplateBinding ScrollViewer.HorizontalScrollMode}&quot; HorizontalScrollBarVisibility=&quot;{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}&quot; IsTabStop=&quot;False&quot; IsHorizontalRailEnabled=&quot;{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}&quot; IsVerticalRailEnabled=&quot;{TemplateBinding ScrollViewer.IsVerticalRailEnabled}&quot; IsDeferredScrollingEnabled=&quot;{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}&quot; Margin=&quot;{TemplateBinding BorderThickness}&quot; Padding=&quot;{TemplateBinding Padding}&quot; Grid.Row=&quot;1&quot; VerticalScrollBarVisibility=&quot;{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}&quot; VerticalScrollMode=&quot;{TemplateBinding ScrollViewer.VerticalScrollMode}&quot; ZoomMode=&quot;Disabled&quot;/&gt;
&lt;ContentPresenter x:Name=&quot;PlaceholderTextContentPresenter&quot; Grid.ColumnSpan=&quot;2&quot; Content=&quot;{TemplateBinding PlaceholderText}&quot; Foreground=&quot;{ThemeResource TextControlPlaceholderForeground}&quot; IsHitTestVisible=&quot;False&quot; Margin=&quot;{TemplateBinding BorderThickness}&quot; Padding=&quot;{TemplateBinding Padding}&quot; Grid.Row=&quot;1&quot; TextWrapping=&quot;{TemplateBinding TextWrapping}&quot;/&gt;
&lt;Button x:Name=&quot;DeleteButton&quot; AutomationProperties.AccessibilityView=&quot;Raw&quot; BorderThickness=&quot;{TemplateBinding BorderThickness}&quot; Grid.Column=&quot;1&quot; FontSize=&quot;{TemplateBinding FontSize}&quot; IsTabStop=&quot;False&quot; Margin=&quot;{ThemeResource HelperButtonThemePadding}&quot; MinWidth=&quot;34&quot; Grid.Row=&quot;1&quot; Style=&quot;{StaticResource DeleteButtonStyle}&quot; Visibility=&quot;Collapsed&quot; VerticalAlignment=&quot;Stretch&quot;/&gt;
&lt;/Grid&gt;
&lt;/ControlTemplate&gt;
&lt;/Setter.Value&gt;
&lt;/Setter&gt;
&lt;/Style&gt;
&lt;/ResourceDictionary&gt;

huangapple
  • 本文由 发表于 2023年5月25日 14:31:23
  • 转载请务必保留本文链接:https://go.coder-hub.com/76329479.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定