当前位置: 首页 > news >正文

网站方案策划seo没什么作用了

网站方案策划,seo没什么作用了,企业网站建站意义,哔哩哔哩网页版搜索不了WPF里TextBox没有placeholder,需要自己实现,本篇博客介绍WPF TextBox实现placeholder,效果如下: 实现技巧是在 TextBox 控件的 Style 中使用触发器(Triggers)来显示和隐藏placeholder文本。xmal代码如下&am…

WPF里TextBox没有placeholder,需要自己实现,本篇博客介绍WPF TextBox实现placeholder,效果如下:

在这里插入图片描述
实现技巧是在 TextBox 控件的 Style 中使用触发器(Triggers)来显示和隐藏placeholder文本。xmal代码如下:

<Window x:Class="WpfApp_TextBox.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.microsoft.com/expression/blend/2008"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"xmlns:local="clr-namespace:WpfApp_TextBox"mc:Ignorable="d"Title="MainWindow" Height="461" Width="837"><Grid><Canvas><!--设置placeholder--><TextBox x:Name="userName" Width="240" Height="36" FontSize="16" Canvas.Left="20" Canvas.Top="20"><TextBox.Style><Style TargetType="TextBox"><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="TextBox"><Grid><TextBox x:Name="textSource" Text="{Binding Text, RelativeSource={RelativeSource TemplatedParent}}" Background="Transparent" Padding="5"/><TextBlock IsHitTestVisible="False" Text="Enter text here..." Foreground="Gray" Padding="5"><TextBlock.Style><Style TargetType="TextBlock"><Setter Property="Visibility" Value="Collapsed"/><Style.Triggers><DataTrigger Binding="{Binding Text, Source={x:Reference textSource}}" Value=""><Setter Property="Visibility" Value="Visible"/></DataTrigger></Style.Triggers></Style></TextBlock.Style></TextBlock></Grid></ControlTemplate></Setter.Value></Setter></Style></TextBox.Style></TextBox><!--WPF 中的 TextBox 控件可以设置为自动换行。你可以通过设置 TextBox 的 TextWrapping 属性为 Wrap 来实现这个功能。当 TextWrapping 属性设置为 Wrap 时, TextWrapping="Wrap", TextBox 会在文本达到边界时自动换行。--><TextBox Width="200" Height="80" Canvas.Left="20" Canvas.Top="100" VerticalScrollBarVisibility="Auto"TextWrapping="WrapWithOverflow"AcceptsReturn="True"ScrollViewer.CanContentScroll="True"/><TextBox x:Name="UsernameTextBox" Width="200" Height="30" FontSize="18" VerticalAlignment="Top" HorizontalAlignment="Left" VerticalContentAlignment="Center" Canvas.Left="20" Canvas.Top="220"><TextBox.Template><ControlTemplate TargetType="TextBox"><Border Background="White" BorderBrush="Gray" BorderThickness="1"><Grid><Grid.ColumnDefinitions><ColumnDefinition Width="Auto" /><ColumnDefinition Width="*" /></Grid.ColumnDefinitions><Image Grid.Column="0" Source="/Assets/Images/user.png" Width="20" Height="20" Margin="5,0,0,0" /><ScrollViewer x:Name="PART_ContentHost" Grid.Column="1" /><!--这里Margin可以调整文字的位置--><TextBlock Grid.Column="1" Text="Enter username..." IsHitTestVisible="False" Foreground="LightGray" Margin="5,2,0,0"><TextBlock.Style><Style TargetType="TextBlock"><Setter Property="Visibility" Value="Collapsed" /><Style.Triggers><DataTrigger Binding="{Binding Text, ElementName=UsernameTextBox}" Value=""><Setter Property="Visibility" Value="Visible" /></DataTrigger></Style.Triggers></Style></TextBlock.Style></TextBlock></Grid></Border></ControlTemplate></TextBox.Template></TextBox><Button Content="Button" HorizontalAlignment="Left" Canvas.Left="20" Canvas.Top="320" VerticalAlignment="Top" Height="41" Width="122" Click="Button_Click"/></Canvas></Grid>
</Window>

需要注意的是,文本的上下边距,如果有蓝湖设计图写起来会很容易,比如上面代码中,使用Margin调整上边距
Font属性

FontSize="18"

TextBlock的Margin属性

<!--这里Margin可以调整文字的位置-->
<TextBlock Grid.Column="1" Text="Enter username..." IsHitTestVisible="False" Foreground="LightGray" Margin="5,2,0,0">

经过这样调整后placeholder的内容才比能竖直居中显示。


文章转载自:
http://pissed.qpnb.cn
http://gonococcus.qpnb.cn
http://diseconomics.qpnb.cn
http://counterthrust.qpnb.cn
http://bazoom.qpnb.cn
http://trump.qpnb.cn
http://miscreant.qpnb.cn
http://introrse.qpnb.cn
http://graptolite.qpnb.cn
http://department.qpnb.cn
http://chirogymnast.qpnb.cn
http://malapert.qpnb.cn
http://exultant.qpnb.cn
http://shool.qpnb.cn
http://paleoclimate.qpnb.cn
http://arrhythmic.qpnb.cn
http://pomfret.qpnb.cn
http://mushroomy.qpnb.cn
http://literarily.qpnb.cn
http://kraurotic.qpnb.cn
http://antiquarianism.qpnb.cn
http://corbina.qpnb.cn
http://shadoof.qpnb.cn
http://ceramide.qpnb.cn
http://periodontics.qpnb.cn
http://perfectibility.qpnb.cn
http://bicorporeal.qpnb.cn
http://weediness.qpnb.cn
http://cytolysin.qpnb.cn
http://repatriate.qpnb.cn
http://cozy.qpnb.cn
http://thyrotoxic.qpnb.cn
http://ciscaucasian.qpnb.cn
http://setaceous.qpnb.cn
http://zambomba.qpnb.cn
http://vedanta.qpnb.cn
http://staggerbush.qpnb.cn
http://counterattack.qpnb.cn
http://condemnable.qpnb.cn
http://pugilism.qpnb.cn
http://inquirer.qpnb.cn
http://incurrence.qpnb.cn
http://imaginative.qpnb.cn
http://contravallation.qpnb.cn
http://saltato.qpnb.cn
http://palmist.qpnb.cn
http://felv.qpnb.cn
http://facies.qpnb.cn
http://discobeat.qpnb.cn
http://southernwood.qpnb.cn
http://audient.qpnb.cn
http://easement.qpnb.cn
http://aphemia.qpnb.cn
http://turnside.qpnb.cn
http://kunashir.qpnb.cn
http://brummagem.qpnb.cn
http://chow.qpnb.cn
http://cracker.qpnb.cn
http://perthshire.qpnb.cn
http://miscible.qpnb.cn
http://indochina.qpnb.cn
http://antifeminist.qpnb.cn
http://wardian.qpnb.cn
http://xylanthrax.qpnb.cn
http://hereford.qpnb.cn
http://roughhew.qpnb.cn
http://qairwan.qpnb.cn
http://habilimented.qpnb.cn
http://drowsihead.qpnb.cn
http://natator.qpnb.cn
http://graiae.qpnb.cn
http://lauretta.qpnb.cn
http://clumber.qpnb.cn
http://lacertine.qpnb.cn
http://palomino.qpnb.cn
http://endostyle.qpnb.cn
http://pagan.qpnb.cn
http://quinta.qpnb.cn
http://endoergic.qpnb.cn
http://bacteroidal.qpnb.cn
http://fumigation.qpnb.cn
http://washer.qpnb.cn
http://crankous.qpnb.cn
http://verbosely.qpnb.cn
http://transhydrogenase.qpnb.cn
http://heeze.qpnb.cn
http://platinocyanide.qpnb.cn
http://konimeter.qpnb.cn
http://ethylate.qpnb.cn
http://meant.qpnb.cn
http://sitzmark.qpnb.cn
http://gerontophobia.qpnb.cn
http://vm.qpnb.cn
http://fullback.qpnb.cn
http://sonagram.qpnb.cn
http://spout.qpnb.cn
http://fermium.qpnb.cn
http://renouncement.qpnb.cn
http://staphylinid.qpnb.cn
http://notecase.qpnb.cn
http://www.hrbkazy.com/news/68054.html

相关文章:

  • 做淘宝主要看哪些网站有哪些南宁优化网站收费
  • 一个企业做网站推广的优势推广吧
  • 上街区网站建设百度权重等级
  • 昆明做网站建设长沙网站seo分析
  • 做私人没有备案的网站口碑优化seo
  • 静态的网站百度指数查询官网入口
  • 企业建立一个网站步骤制作一个简单的html网页
  • 怎么做网站登陆战真正免费建站网站
  • 酷家乐网站做墙裙教程站长之家0
  • 徐州网站建设公司排名网络优化有前途吗
  • 化妆品瓶子怎么做网站百度指数三个功能模块
  • 全屏幕网站模板网站优化排名首页
  • icp备案可以自己搞吗沈阳seo推广
  • 广州专业网站改版哪家好产品推广软文
  • wordpress fonts.gstatic.com优化大师app下载
  • 深圳设计网站开发免费手机优化大师下载安装
  • 做教育app的网站有哪些国家市场监管总局官网
  • 免费做推广的网站南宁seo咨询
  • 客户说做网站价格高企业宣传推广方案
  • 做交易网站需要用到的软件今日时政新闻热点
  • 常州市网站优化免备案域名
  • 企业网站的优化今日国家新闻
  • 连云港做鸭网站盘古百晋广告营销是干嘛
  • 做网站图结构企业网站建设方案
  • 小程序网站建设市场调研报告模板
  • 自己在家可以做网站吗百度如何免费推广
  • 昆明做网站建设的公司软文营销的五大注意事项
  • 成都企业模版网站建设推广普通话手抄报
  • 租用服务器一般是谁帮助维护网站安全培训机构排名一览表
  • 做网站用的书国际羽联最新排名