SuperAPI AI 工具集

syncfusion-wpf-text-input-layout

通用与其它

查看项目

更新于 10-15 23:56

技能介绍

用途:该技能说明如何在 WPF 中使用 Syncfusion 的 SfTextInputLayout 控件,为 TextBox、PasswordBox、ComboBox 等输入控件包裹装饰元素,实现浮动标签、辅助文本、字符计数与错误状态反馈。

主要能力:支持浮动提示标签(Hint)及 HintFloatMode 的 Float、AlwaysFloat、None 三种浮动模式;容器样式有 Outlined(默认)、Filled、None;可配置 HelperText 帮助文本、ErrorText 错误文本与 HasError 校验状态,以及 CharMaxLength 与 CharCountVisibility 字符计数。支持 LeadingView、TrailingView 前后图标及其 Inside/Outside 位置。可按聚焦、未聚焦、错误状态分别设置 FocusedForeground、Foreground、ErrorForeground、ContainerBackground、FocusedBorderBrush 等颜色,并调整 StrokeThickness、FocusedStrokeThickness、OutlineCornerRadius、InputViewPadding。支持 RTL(FlowDirection)。

使用方式:在 XAML 中引入命名空间 inputLayout="clr-namespace:Syncfusion.UI.Xaml.TextInputLayout;assembly=Syncfusion.SfTextInputLayout.WPF",用 SfTextInputLayout 包裹输入控件并设置属性;也可在 C# 中 new SfTextInputLayout() 并设置 Hint、HelperText、InputView 等。

适用场景:注册与登录表单、带校验的数据录入、Material Design 风格输入框、带图标的搜索框、密码框、下拉选择框等。

限制:错误校验逻辑需在应用层自行实现;DropDownBorder 仅适用于 ComboBox/ComboBoxAdv;OutlineCornerRadius 仅适用于 Outlined 容器类型;FocusedBorderBrush 会覆盖 FocusedForeground 对边框的作用。安装步骤、程序集引用与主题(SfSkinManager)细节请参见资料指引的 getting-started 文档,原文未展开具体内容。