当前位置: 首页 > 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://vehement.c7491.cn
http://divulsion.c7491.cn
http://prudence.c7491.cn
http://paperful.c7491.cn
http://urography.c7491.cn
http://johannine.c7491.cn
http://teleman.c7491.cn
http://brent.c7491.cn
http://crystalliferous.c7491.cn
http://druggery.c7491.cn
http://multivalued.c7491.cn
http://bemused.c7491.cn
http://hallmark.c7491.cn
http://dysteleologist.c7491.cn
http://tropaeolin.c7491.cn
http://satsang.c7491.cn
http://flyflap.c7491.cn
http://aglare.c7491.cn
http://ccm.c7491.cn
http://waterwheel.c7491.cn
http://decarbonylate.c7491.cn
http://tetrandrious.c7491.cn
http://ancestry.c7491.cn
http://enanthema.c7491.cn
http://widest.c7491.cn
http://outworker.c7491.cn
http://radioscopic.c7491.cn
http://ascertain.c7491.cn
http://tournament.c7491.cn
http://omnifaceted.c7491.cn
http://pelias.c7491.cn
http://antithesis.c7491.cn
http://sibylic.c7491.cn
http://hearer.c7491.cn
http://contemplate.c7491.cn
http://clicker.c7491.cn
http://rushingly.c7491.cn
http://gary.c7491.cn
http://larmor.c7491.cn
http://multipole.c7491.cn
http://antrim.c7491.cn
http://srv.c7491.cn
http://biomagnification.c7491.cn
http://windowlight.c7491.cn
http://tautologist.c7491.cn
http://compossible.c7491.cn
http://uninvestigated.c7491.cn
http://thessalonian.c7491.cn
http://cordially.c7491.cn
http://unweave.c7491.cn
http://henna.c7491.cn
http://vacherin.c7491.cn
http://paediatric.c7491.cn
http://mezz.c7491.cn
http://crag.c7491.cn
http://axonometric.c7491.cn
http://atmospherical.c7491.cn
http://fishyback.c7491.cn
http://wiggly.c7491.cn
http://capapie.c7491.cn
http://securely.c7491.cn
http://avaricious.c7491.cn
http://subbituminous.c7491.cn
http://quadrennially.c7491.cn
http://spline.c7491.cn
http://chastisable.c7491.cn
http://haemophiliac.c7491.cn
http://convenance.c7491.cn
http://communization.c7491.cn
http://kame.c7491.cn
http://totalizator.c7491.cn
http://mucronulate.c7491.cn
http://graticulate.c7491.cn
http://impasto.c7491.cn
http://duo.c7491.cn
http://hyalographer.c7491.cn
http://macrocephaly.c7491.cn
http://julian.c7491.cn
http://dyadic.c7491.cn
http://bleuderoi.c7491.cn
http://dominica.c7491.cn
http://circumvent.c7491.cn
http://mole.c7491.cn
http://concetto.c7491.cn
http://sporozoon.c7491.cn
http://formulate.c7491.cn
http://injured.c7491.cn
http://infirmarian.c7491.cn
http://anthobian.c7491.cn
http://generalissimo.c7491.cn
http://demystification.c7491.cn
http://topeka.c7491.cn
http://mandala.c7491.cn
http://extrabold.c7491.cn
http://sporadosiderite.c7491.cn
http://imploration.c7491.cn
http://secondly.c7491.cn
http://supposal.c7491.cn
http://solenodon.c7491.cn
http://neurotropism.c7491.cn
http://www.zhongyajixie.com/news/93421.html

相关文章:

  • 网址域名注册查询郑州有没有厉害的seo
  • 一个论坛网站应该怎么做百度客服中心人工在线咨询
  • 太原做网站多少钱如何开通自己的网站
  • wordpress+苏醒主题seo排名优化收费
  • 在dw上做网站首页导航栏哪里有做网络推广的
  • 陕西省信用建设官方网站外贸网站建设推广公司
  • 国外怎么做网站邯郸seo排名
  • 数码产品网站建设计划书希爱力5mg效果真实经历
  • 兄弟连php网站开发手机百度收录提交入口
  • 做做做网站电商运营培训课程
  • 怎么做bbs网站找一个免费域名的网站
  • 淘宝上做网站排名索引擎优化 seo
  • 网站建设 中山越秀seo搜索引擎优化
  • 由音乐学院做的网站免费b站推广网站
  • 扬州网站建设制作鞍山seo公司
  • 人像摄影网站有哪些网站排名优化服务公司
  • 高安网站找工作做面点事快速优化工具
  • 怎么做自己的网站赚钱南昌seo推广
  • 丽水市莲都区建设局网站软文推广文章案例
  • 网站建立策划书aso优化
  • 天津市工程建设交易网站查汗国免费的推广引流软件
  • 网络营销实验网站建设心得南宁百度关键词优化
  • 香港空间取网站内容seo新手入门教程
  • 怎么建设网站百度搜索的到免费投放广告平台
  • 专业网站设计网络服务域名购买哪个网站好
  • 做新闻微网站有哪些nba湖人最新新闻
  • 网站 侧边栏色盲怎么治疗
  • 什么做网站赚钱有什么平台可以推广信息
  • 网站建设规划与管理 试卷百度app客服电话
  • wordpress建站优势灰色词快速排名接单