Effects of the enumerated values of TextWrapping. : TextBlock « Windows Presentation Foundation « C# / C Sharp

Home
C# / C Sharp
1.2D Graphics
2.Class Interface
3.Collections Data Structure
4.Components
5.Data Types
6.Database ADO.net
7.Date Time
8.Design Patterns
9.Development Class
10.Event
11.File Stream
12.Generics
13.GUI Windows Form
14.Internationalization I18N
15.Language Basics
16.LINQ
17.Network
18.Office
19.Reflection
20.Regular Expressions
21.Security
22.Services Event
23.Thread
24.Web Services
25.Windows
26.Windows Presentation Foundation
27.XML
28.XML LINQ
C# / C Sharp » Windows Presentation Foundation » TextBlock 




Effects of the enumerated values of TextWrapping.
Effects of the enumerated values of TextWrapping.
  

<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  x:Class="WpfApplication1.Window1" Height="480" Width="640"
  Title="TextWrap Sample">
  <StackPanel Margin="0,0,0,10" Background="LightSkyBlue">
    <StackPanel Orientation="Horizontal" Margin="0,0,0,20">
      <Button Name="btn1" Background="Silver" Width="100" Click="Wrap">Wrap</Button>
      <Button Name="btn2" Background="Silver" Width="100" Click="NoWrap">NoWrap</Button>
      <Button Name="btn4" Background="Silver" Width="100" Click="WrapWithOverflow">WrapWithOverflow</Button>
    </StackPanel>
    <TextBlock Name="txt2" TextWrapping="Wrap" Margin="0,0,0,20" Foreground="Black">
      Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, 
      consectetuer adipiscing elit.Lorem ipsum dolor sit aet, consectetuer adipiscing elit.
      Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
    </TextBlock>
    <TextBlock FontSize="12" Name="txt1">
      The TextWrap property is currently set to Wrap.
    </TextBlock>    
  </StackPanel>
</Window>
//File:Window.xaml.cs
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Media;

namespace WpfApplication1
{

  public partial class Window1 : Window
  {
        public void Wrap(object sender, RoutedEventArgs e)
        {
            txt2.TextWrapping = System.Windows.TextWrapping.Wrap;
            txt1.Text = "The TextWrap property is currently set to Wrap.";
        }
        public void NoWrap(object sender, RoutedEventArgs e)
        {
            txt2.TextWrapping = System.Windows.TextWrapping.NoWrap;
            txt1.Text = "The TextWrap property is currently set to NoWrap.";
        }
        public void WrapWithOverflow(object sender, RoutedEventArgs e)
        {
            txt2.TextWrapping = System.Windows.TextWrapping.WrapWithOverflow;
            txt1.Text = "The TextWrap property is currently set to WrapWithOverflow.";
        }
    }
}

   
    
  














Related examples in the same category
1.TextBlock VerticalAlignmentTextBlock VerticalAlignment
2.Emboss TextEmboss Text
3.Engrave TextEngrave Text
4.TextBlock ScaleTransform ScaleXTextBlock ScaleTransform ScaleX
5.TextBlock ScaleTransform ScaleY and TransformGroupTextBlock ScaleTransform ScaleY and TransformGroup
6.Text Drop ShadowText Drop Shadow
7.TextBlock Opacity AnimationTextBlock Opacity Animation
8.Adding Hyperlink to TextBlockAdding Hyperlink to TextBlock
9.Spell Check a TextBox or RichTextBox Control in Real TimeSpell Check a TextBox or RichTextBox Control in Real Time
10.Animates the text block's colorAnimates the text block's color
11.Animates the text block's opacity(fading text)Animates the text block's opacity(fading text)
12.Animates the text block's widthAnimates the text block's width
13.TextEffect to animateTextEffect to animate
14.Animates the horizontal center of the RotateTransform applied to the TextEffect
15.Animates the position of the TextEffect
16.Set TextBlock.FontSize for Grid
17.Add TextBlock into a GridAdd TextBlock into a Grid
18.Intrinsic character direction in TextBlockIntrinsic character direction in TextBlock
19.Mixed character directions and TextBlockMixed character directions and TextBlock
20.FlowDirection of TextBlockFlowDirection of TextBlock
21.Use RenderTransform to transform a TextBlockUse RenderTransform to transform a TextBlock
22.Use LayoutTransform to transform a TextBlockUse LayoutTransform to transform a TextBlock
23.Set Margins for TextBlock in Grid ResourceSet Margins for TextBlock in Grid Resource
24.Set TextWrapping to True for TextBlockSet TextWrapping to True for TextBlock
25.Set ToolTip text for TextBlockSet ToolTip text for TextBlock
26.Set Text value for TextBlockSet Text value for TextBlock
27.Set Foreground color for TextBlockSet Foreground color for TextBlock
28.Add Border to TextBlockAdd Border to TextBlock
29.Empirical Tilted Text ShadowEmpirical Tilted Text Shadow
30.Fill the overline decoration with a linear gradient brush in C#Fill the overline decoration with a linear gradient brush in C#
31.Fill the baseline decoration with a linear gradient brush in C#Fill the baseline decoration with a linear gradient brush in C#
32.Fill the underline decoration with a solid color brush in C#Fill the underline decoration with a solid color brush in C#
33.Fill the strikethrough decoration with a solid color brush in C#Fill the strikethrough decoration with a solid color brush in C#
34.Put Rectangle into TextBlockPut Rectangle into TextBlock
35.Programmatically change the way in which TextBlock is trimmed when it exceeds the outer boundaries of its containing box.Programmatically change the way in which TextBlock is trimmed when it exceeds the outer boundaries of its containing box.
36.Simple underline decorationSimple underline decoration
37.Use Run the mark underlink TextDecorationsUse Run the mark underlink TextDecorations
38.VerticalAlignment=Top HorizontalAlignment=LeftVerticalAlignment=Top  HorizontalAlignment=Left
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.