首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在wpf xaml中设置textbox的提示文本和提示文本颜色?

如何在wpf xaml中设置textbox的提示文本和提示文本颜色?
EN

Stack Overflow用户
提问于 2020-07-03 07:57:14
回答 1查看 621关注 0票数 0

我想在xaml文本框中创建提示文本并设置提示文本颜色。有没有办法直接在xaml文件中设置文本框中的提示文本和提示文本颜色?请告诉我怎么走。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-07-03 08:10:41

我使用MaterialDesignThemes。下载NuGet并按如下所示提供给我们:

代码语言:javascript
复制
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" 

<TextBox materialDesign:HintAssist.Hint="Floating Hint" Style="{StaticResource MaterialDesignFloatingHintTextBox}" VerticalAlignment="Center"/>

您还需要在App.xaml中进行以下更改

代码语言:javascript
复制
<ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Dark.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.DeepPurple.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.DeepPurple.xaml" />
        </ResourceDictionary.MergedDictionaries>

MaterialDesign Getting Started

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62706639

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档