[Silverlight 4] Textbox style模擬Textblock 使可以選取、複製
childwindow 做為訊息視窗,使用textblock,可是textbloc無法選取內容及複製,
就改用textbox假裝成textblock
---原本的textblock
<controls:ChildWindow x:Class="ManageBack.Controls.MessageWindows"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
Width="200" Height="150"
Title="新信息">
<Grid x:Name="LayoutRoot" Width="140" Height="78">
<StackPanel Orientation="Vertical" >
<TextBlock x:Name="ErrorTextBox" Width="140" Height="45" VerticalAlignment="Center" TextWrapping="Wrap" TextAlignment="Center" Foreground="Red" />
<Button x:Name="OKButton" Click="OKButton_Click" Width="75" Height="23" HorizontalAlignment="Center" Margin="0,5,0,0"
TabIndex="0" Content="确定"/>
</StackPanel>
</Grid>
</controls:ChildWindow>
---原本的textblock
ContentPresenter 一定要加x:Name="ContentElement"
指出該control的行為是哪個control的行為
---改成textbox
<controls:ChildWindow x:Class="ManageBack.Controls.MessageWindows"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
Width="200" Height="150"
Title="新信息">
<controls:ChildWindow.Resources>
<Style TargetType="TextBox">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Grid>
<ContentPresenter x:Name="ContentElement"></ContentPresenter>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</controls:ChildWindow.Resources>
<Grid x:Name="LayoutRoot" Width="140" Height="78">
<StackPanel Orientation="Vertical" >
<TextBox x:Name="ErrorTextBox" Width="140" Height="45" VerticalAlignment="Center" TextWrapping="Wrap" TextAlignment="Center" Foreground="Red" IsReadOnly="True"/>
<Button x:Name="OKButton" Click="OKButton_Click" Width="75" Height="23" HorizontalAlignment="Center" Margin="0,5,0,0"
TabIndex="0" Content="确定"/>
</StackPanel>
</Grid>
</controls:ChildWindow>
---改成textbox

[Silverlight 4] Textbox style模擬Textblock 使可以選取、複製的更多相关文章
- PCB模擬設計接地的指導原則
接地無疑是系統設計中最為棘手的問題之一.盡管它的概念相對比較簡單,實施起來卻很復雜,遺憾的是,它沒有一個簡明扼要可以用詳細步驟描述的方法來保證取得良好效果,但如果在某些細節上處理不當,可能會導致令人頭 ...
- MAC安裝《Genymotion Android模擬器》大玩Android APP (神魔之塔)
链接地址:http://www.minwt.com/mac/10083.html/comment-page-2 MAC» 智慧型裝罝» Android | 2014/02/12 Android是一個開 ...
- javascript中的function命名空間與模擬getter、setter
function的命名空間 在javascript中,function也可以擁有自己的命名空間例如以下這段程式碼: 12345678 function () { return 'I am A';} A ...
- 【原创】Silverlight之TextBox的LostFocus、GotFocus事件
<TextBox x:Name="txtCount" Width="200" Height="35" GotFocus="t ...
- SQL模擬死結產生
引用自:http://jengting.blogspot.tw/2012/06/sql.html 根據 MSDN 將死結數量降至最低 裡的圖型模擬死結產生 ~~ 在 SSMS 內開啟兩個 T-SQL ...
- 小林的VB6動態壁紙模擬程序
本項目參考了以下資料[這可能對你理解程序運行有幫助]: https://github.com/Yinmany/WinWallpaper https://blog.csdn.net/breaksoftw ...
- bzoj 1067: [SCOI2007]降雨量 模擬
1067: [SCOI2007]降雨量 Time Limit: 1 Sec Memory Limit: 162 MBSubmit: 2010 Solved: 503[Submit][Status] ...
- 组合数取模Lucas定理及快速幂取模
组合数取模就是求的值,根据,和的取值范围不同,采取的方法也不一样. 下面,我们来看常见的两种取值情况(m.n在64位整数型范围内) (1) , 此时较简单,在O(n2)可承受的情况下组合数的计算可以 ...
- Visual Studio 2008 使用 WinCE 5.0 Emulator
1. 簡介 由於 Visua Studio 2008 與 WinCE 5.0 Emulator 並沒有完全整合,因此想要測試我們所開發的 Windows CE 程式,需透過設定,將我們所開發的程式丟到 ...
随机推荐
- 如何使用 Set 来提高JS代码的性能
摘要: 高效使用Set! 作者:前端小智 原文:如何使用 Set 来提高代码的性能 Fundebug经授权转载,版权归原作者所有. 为了保证的可读性,本文采用意译而非直译. 我确信有很多开发人员坚持使 ...
- vnc服务器和windows2012密钥
[root@localhost ~]# vncserver #启动服务器 windows 2012 64位-server版本的密钥 Windows Server 2012 Standard 密钥:NB ...
- Java数据库连接组件C3P0和DBCP
C3P0连接池组件 开源数据库连接池组件 jar包:c3p0-0.9.2.jar和mchange-commons-java-0.2.2.3.jar 支持JDBC3规范和JDBC2的标准扩展 使用项目H ...
- E05 【餐厅】What kind of coffee or tea would you like?
核心句型 What kind of coffee or tea would you like? 你想喝什么咖啡或者茶? What would you like? 你喜欢什么?/你想要什么? ...
- 201871010126 王亚涛 《面向对象程序设计JAVA》第十四周学习总结
内容 这个作业属于哪个课程 https://www.cnblogs.com/nwnu-daizh/ 这个作业的要求在哪里 https://www.cnblogs.com/nwnu-daizh/p/11 ...
- 【Spring AOP】AOP的实现(三)
一.Spring 对AOP的支持 Spring中AOP代理由Spring的IOC容器负责生成.管理,其依赖关系也由IOC容器负责管理.因此,AOP代理可以直接使用容器中的其它bean实例作为目标,这种 ...
- USACO Buying Hay
洛谷 P2918 [USACO08NOV]买干草Buying Hay https://www.luogu.org/problem/P2918 JDOJ 2592: USACO 2008 Nov Sil ...
- 【java】isEmpty VS isBlank 的区别
- 一种css效果:标题带色块,React+Less
.title { display: inline-block; font-size: 15px; font-weight: bold; position: relative; padding: 5px ...
- The 13th Chinese Northeast Collegiate Programming Contest
题解: solution Code: A. Apple Business #include<cstdio> #include<algorithm> #include<ve ...