




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、RichTextBox 是最受欢迎的 WP7控件之一。Beta版的控件有很多限制:只读这个控件不在 tool box中显示没有默认的样式有两种常用的方法来添加这个控件。一是直接添加XAML :<iRichTextBox x:Name=*'rtxtbox'* Margin=" 12,217>31,246'' > <Paragraph><Bold Foregrouiinid = "&LUE">Hey I am Blue and Bold !</Bold> f/Par白grap
2、hA <Paragraph >Dhananjay Kunar is her? on DebugMode aragr曰phA</H.i chTextBox>还有一种是在代码中添加Control s, Rk hTextBok PtK = new Systows .Oort rois Jictfe ;如果你只是在XAML中添加了控件,然后运行程序,你会发现这个控件不会显示出来,这 是因为缺少默认的样式。所以我们要在App.Xaml中给RichTextBox添加默认的样式vApp licationx:Class="RichTextBox.A pp"xmlns
3、="htt p: /xmlns:x="htt p: / xmlns: phone-'clr-names pace:Microsoft. Phone.Controls;assembly=Microsoft. PhoneH xmlns:shell="clr-names pace:Microsoft .P hone.Shell;assembly=Microsoft .P hone"><!-A pp lication Resources- vApp lication.Resources<Style TargetTy pe="R
4、ichTextBox">vSetter Prop erty="FontSize" Value="StaticResource PhoneFontSizeNormal" /> vSetter Prop erty="Background" Value="Trans parent" /> vSetter Prop erty="BorderBrush" Value="Trans parent" /> vSetter Prop erty="B
5、orderThickness" Value="0"/> vSetter Prop erty="HorizontalContentAlignment" Value="Stretch" /> vSetter Prop erty="VerticalContentAlignment" Value="Center" /> vSetter Prop erty=" Padding" Value="0" /> vSetter Prop e
6、rty="Te mpl ate"> vSetter.Value> vControlTe mpl ate TargetT yp e="RichTextBox"> vGrid Background="Trans parent" vBorder Background="Te mp lateBinding Background"vSetterProp erty="Foreground"Value="StaticResourceP honeForegroundBrush&quo
7、t;/>BorderBrush="Te mp lateBinding BorderBrush" BorderThickness="Te mpl ateBindingBorderThickness" Margin="StaticResource PhoneHorizontalMargin"> vContentControl x:Name="ContentElement"HorizontalContentAlignment="Te mp lateBinding HorizontalContentA
8、lignment"VerticalContentAlignment="Te mp lateBinding VerticalContentAlignment"P adding="Te mpl ateBinding P adding"/> v/Border> v/Grid> v/ControlTe mpl ate> v/Setter.Value> v/Setter> v/Style></A pp lication.Resources vApp lication.A pp licationLifetim
9、eObjects v!-Required object that handles lifetime events for the app lication-> <shell: PhoneA pp licationServiceLaunching="A pp lication_Launching" Closing="A pp lication_Closing"Activated="A pp lication_Activated"Deactivated="A pp lication_Deactivated"
10、/> v/A pp lication.A pp licationLifetimeObjects v/A pp lication>添加样式以后再次运行程序,应该是这样的MY APPLICATIONpage nameDhananjay Kumar is hre on DebugMode要在这个控件中添加一个按钮,你需要把按钮添加到Ed J_L LEL rL- R -z.In li neUIC on tai nerpaTagFaph ><InlineUIContainer><Buttonx:Name='*bt nRch"Content'&
11、#39;RichTectBox Button " 门让k="btnRch_Click" /> </InlineUICoiintainier>c/Pagraphs要添加一个带下划线的文字,我们需要使用Un derli ne标签<Paragraph><Undepline>I am UndenLined</Underline></Pardgraph要添加一个图片的话,需要使用Image标签:<Paragraph<InLineUIContainer><Image Source*Pengui
12、ns * jpg" /></InlineUIContainer></Paragraph>F面的代码是给 RichTextBox添加不同的段落,按钮,图片等:vp hone:P honeA pp licatio nP agex:Class="RichTextBox.Main Page"xmlns="htt p:/xmlns:x="htt p: / xmlns: phone-'clr-names pace:Microsoft. Phone.Controls;assembly=Microsoft. PhoneH
13、xmlns:shell="clr-names pace:Microsoft .P hone.Shell;assembly=Microsoft .P hone"xmlns:d="htt p: / pression/blend/2008"xmlns:mc="htt p:/schemas.o /mark up-co mp atibility/2006"mc:lgnorable="d" d:DesignWidth="480" d:DesignHeight="7
14、68"FontFamily="StaticResource P honeFontFamilyNormal"FontSize="StaticResource P honeFontSizeNormal"Foreground="StaticResource P honeForegroundBrush"Supp ortedOnentations="P ortrait" Orientation="P ortrait"shell:SystemTray.lsVisible="True&qu
15、ot;><!-LayoutRoot is the root grid where all p age content is pl aced-> <Grid x:Name="LayoutRoot" Background="Trans parent" <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> </Grid.RowDefinitions&
16、gt; v!-Title Panel contains the name of the app lication and p age title-> <Stack Panel x:Name="Title Panel" Grid.Row="0" Margin="12,17,0,28"> <TextBlock x:Name="A ppi icationTitle" Text="MY APP LICATION"Style="StaticResource P honeT
17、extNormalStyle"/> <TextBlock x:Name=" PageTitle" Text=" page name" Margin="9,-7,0,0"Style="StaticResource PhoneTextTitle1Style"/> </Stack Panel<!-Content Panel - pl ace additional content here-> <Grid x:Name="Content Panel"
18、Grid.Row="1" Margin="12,0,12,0"> vRichTextBox x:Name="rtxtbox" Margin="0,-84,0,0"> vP aragra ph> vBold Foreground="BLUE">Hey I am Blue and Bold !v/Bold> v/P aragra ph>vP aragra ph> vlnlineUIContainer> vImage Source="P enguins.j pg" /> v/InlineUIContainer> v/P aragra ph> vP aragra ph >Dhananjay Kumar is here on DebugModev/P aragra p
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- YY/T 1284-2024牙科学牙科镊
- 销售公司业务员劳动合同协议
- 房屋按揭共同还款合同样本2025
- 生态养殖基地租赁合同
- 特许经营合同示范文本
- 新能源货车租赁合同
- 采购合同管理:风险防范与应对措施
- 合作建房借款合同(单位集体住房)
- 度产品试用合同协议
- 金属冶炼安全管理课件
- 2025包头青山宾馆有限公司面向社会公开招聘18人笔试参考题库附带答案详解
- 课件-DeepSeek从入门到精通
- 2025至2030年中国毛绒卡通玩具数据监测研究报告
- 2025年度智能充电桩场地租赁合同范本3篇
- 2024年芜湖职业技术学院高职单招语文历年参考题库含答案解析
- 心电监护仪的操作及注意事项 课件
- GB/T 718-2024铸造用生铁
- 细胞生物学(全套1047张课件)
- CFM56-7发动机滑油系统及其常见故障分析(共41页)
- 《嵌入式技术》课程标准(STM32版)
- tplink-mr11u刷openwrt教程
评论
0/150
提交评论