TextBox各种设置
前台:
1 <StackPanel> 2 <TextBlock Margin="10" TextWrapping="Wrap"> 3 TextBlock with <Bold>bold</Bold>, <Italic>italic</Italic> and <Underline>underlined</Underline> text. 4 </TextBlock> 5 6 <TextBlock> 7 <Hyperlink NavigateUri="https://www.google.com.hk" RequestNavigate="Hyperlink_RequestNavigate"> 8 Click here 9 </Hyperlink> 10 </TextBlock> 11 12 <TextBlock Margin="10" TextWrapping="Wrap"> 13 This text has a <Hyperlink RequestNavigate="Hyperlink_RequestNavigate" NavigateUri="https://www.google.com">link</Hyperlink> in it. 14 </TextBlock> 15 16 <TextBlock Margin="10" TextWrapping="Wrap"> 17 This <Span FontWeight="Bold">is</Span> a 18 <Span Background="Silver" Foreground="Maroon">TextBlock</Span> 19 with <Span TextDecorations="Underline">several</Span> 20 <Span FontStyle="Italic">Span</Span> elements, 21 <Span Foreground="Blue"> 22 using a <Bold>variety</Bold> of <Italic>styles</Italic> 23 </Span>. 24 </TextBlock> 25 26 <StackPanel x:Name="sp_text"> 27 28 </StackPanel> 29 30 <!--<StackPanel Margin="10"> 31 <Label Content="_Name:" Target="{Binding ElementName=txtName}" /> 32 <TextBox Name="txtName" /> 33 <Label Content="{Binding ElementName=txtMail, Mode=TwoWay, Path=Text}" Target="{Binding ElementName=txtMail}" /> 34 <TextBox Name="txtMail" /> 35 </StackPanel>--> 36 37 </StackPanel>
1 <StackPanel> 2 <TextBlock Margin="10" TextWrapping="Wrap"> 3 TextBlock with <Bold>bold</Bold>, <Italic>italic</Italic> and <Underline>underlined</Underline> text. 4 </TextBlock> 5 6 <TextBlock> 7 <Hyperlink NavigateUri="https://www.google.com.hk" RequestNavigate="Hyperlink_RequestNavigate"> 8 Click here 9 </Hyperlink> 10 </TextBlock> 11 12 <TextBlock Margin="10" TextWrapping="Wrap"> 13 This text has a <Hyperlink RequestNavigate="Hyperlink_RequestNavigate" NavigateUri="https://www.google.com">link</Hyperlink> in it. 14 </TextBlock> 15 16 <TextBlock Margin="10" TextWrapping="Wrap"> 17 This <Span FontWeight="Bold">is</Span> a 18 <Span Background="Silver" Foreground="Maroon">TextBlock</Span> 19 with <Span TextDecorations="Underline">several</Span> 20 <Span FontStyle="Italic">Span</Span> elements, 21 <Span Foreground="Blue"> 22 using a <Bold>variety</Bold> of <Italic>styles</Italic> 23 </Span>. 24 </TextBlock> 25 26 <StackPanel x:Name="sp_text"> 27 28 </StackPanel> 29 30 <!--<StackPanel Margin="10"> 31 <Label Content="_Name:" Target="{Binding ElementName=txtName}" /> 32 <TextBox Name="txtName" /> 33 <Label Content="{Binding ElementName=txtMail, Mode=TwoWay, Path=Text}" Target="{Binding ElementName=txtMail}" /> 34 <TextBox Name="txtMail" /> 35 </StackPanel>--> 36 37 </StackPanel> 38 39 <StackPanel Margin="10"> 40 <Label Target="{Binding ElementName=txtName}"> 41 <StackPanel Orientation="Horizontal"> 42 <Image Source="http://cdn1.iconfinder.com/data/icons/fatcow/16/bullet_green.png" /> 43 <AccessText Text="_Name:" /> 44 </StackPanel> 45 </Label> 46 <TextBox Name="txtName" /> 47 <Label Target="{Binding ElementName=txtMail}"> 48 <StackPanel Orientation="Horizontal"> 49 <Image Source="http://cdn1.iconfinder.com/data/icons/fatcow/16/bullet_blue.png" /> 50 <AccessText Text="_Mail:" /> 51 </StackPanel> 52 </Label> 53 <TextBox Name="txtMail" /> 54 </StackPanel> 55 56 <Grid Margin="10"> 57 <TextBox AcceptsReturn="True" TextWrapping="Wrap" SpellCheck.IsEnabled="True" Language="en-US" /> 58 </Grid> 59 60 61 <DockPanel Margin="10"> 62 <TextBox SelectionChanged="TextBox_SelectionChanged" DockPanel.Dock="Top" /> 63 <TextBox Name="txtStatus" AcceptsReturn="True" TextWrapping="Wrap" IsReadOnly="True" /> 64 65 </DockPanel> 66 67 68 <StackPanel Margin="10"> 69 <Label FontWeight="Bold">Application Options</Label> 70 <CheckBox> 71 <TextBlock> 72 Enable feature <Run Foreground="Green" FontWeight="Bold">ABC</Run> 73 </TextBlock> 74 </CheckBox> 75 <CheckBox IsChecked="True"> 76 <WrapPanel> 77 <TextBlock> 78 Enable feature <Run FontWeight="Bold">XYZ</Run> 79 </TextBlock> 80 <!--<Image Source="/WpfTutorialSamples;component/Images/question.png" Width="16" Height="16" Margin="5,0" />--> 81 </WrapPanel> 82 </CheckBox> 83 <CheckBox> 84 <TextBlock> 85 Enable feature <Run Foreground="Blue" TextDecorations="Underline" FontWeight="Bold">WWW</Run> 86 </TextBlock> 87 </CheckBox> 88 </StackPanel>
作者:Ants_double
出处:https://www.cnblogs.com/ants_double/
本文版权归作者和博客园所有,欢迎转载。转载请在留言板处留言给我,且在文章标明原文链接,谢谢!
如果您觉得本篇博文对您有所收获,觉得我还算用心,请点击右下角的 [大拇指],谢谢!