Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. RichTextBox UI elements animating??

RichTextBox UI elements animating??

Scheduled Pinned Locked Moved WPF
wpfcsharpcsswcfdesign
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • _ Offline
    _ Offline
    _iobuf
    wrote on last edited by
    #1

    I have a RichTextBox in my app, which is inside a control that is composed of a grid with 2 columnds, i.e.

    <Grid x:Name="LayoutRoot"
    VerticalAlignment="Top" Height="Auto">
    <Grid.ColumnDefinitions>
    <ColumnDefinition Width="150"/>
    <ColumnDefinition Width="*"/>
    </Grid.ColumnDefinitions>
    <Border x:Name="bdrLeft" Height="Auto"
    Background="{DynamicResource SplitRichTextBoxRightSideBGBrush}"
    BorderBrush="{DynamicResource SplitRichTextBoxRightSideBorderBrush}"
    BorderThickness="1,1,0,1"
    CornerRadius="3,0,0,3"
    VerticalAlignment="Stretch">
    <ContentPresenter x:Name="cpRightSide"
    VerticalAlignment="Stretch"
    HorizontalAlignment="Stretch"
    Margin="0,0,0,0"
    Width="Auto"
    Height="Auto"
    TextElement.Foreground="{DynamicResource SplitRichTextBoxLeftSideForegroundBrush}"/>
    </Border>
    <Border x:Name="bdrRight"
    Height="Auto"
    Grid.Column="1"
    Background="{DynamicResource TextBoxBGBrush}"
    BorderBrush="{DynamicResource TextBoxBorderBrush}"
    BorderThickness="1,1,1,1"
    CornerRadius="0,3,3,0"/>
    <RichTextBox x:Name="rtbMain"
    HorizontalAlignment="Center"
    FontSize="{DynamicResource DefaultFontSize}"
    Height="Auto"
    BorderBrush="Transparent"
    Background="Transparent"
    Foreground="{DynamicResource DEFAULT_Font_Dark}"
    VerticalAlignment="Center"
    AcceptsReturn="False"
    AcceptsTab="False"
    Style="{DynamicResource ClearRichTextBoxStyle}"
    Grid.Column="1"
    Margin="0,3,0,3">
    <localControl:EnabledFlowDocument x:Name="efdMainDocument" PageWidth="{Binding ElementName=rtbMain, Path=ActualWidth}"/>
    </RichTextBox>
    </Grid>

    All the animations in the code are set to 00:00:00.00 However, when I add a UIElement or even text to the FlowDocument on startup, the text/uielement appear in the center of the flowdocument, then animate over to the left side where they should be. Is this a bug in WPF? I can't find anything in my code that would cause this.

    _ 1 Reply Last reply
    0
    • _ _iobuf

      I have a RichTextBox in my app, which is inside a control that is composed of a grid with 2 columnds, i.e.

      <Grid x:Name="LayoutRoot"
      VerticalAlignment="Top" Height="Auto">
      <Grid.ColumnDefinitions>
      <ColumnDefinition Width="150"/>
      <ColumnDefinition Width="*"/>
      </Grid.ColumnDefinitions>
      <Border x:Name="bdrLeft" Height="Auto"
      Background="{DynamicResource SplitRichTextBoxRightSideBGBrush}"
      BorderBrush="{DynamicResource SplitRichTextBoxRightSideBorderBrush}"
      BorderThickness="1,1,0,1"
      CornerRadius="3,0,0,3"
      VerticalAlignment="Stretch">
      <ContentPresenter x:Name="cpRightSide"
      VerticalAlignment="Stretch"
      HorizontalAlignment="Stretch"
      Margin="0,0,0,0"
      Width="Auto"
      Height="Auto"
      TextElement.Foreground="{DynamicResource SplitRichTextBoxLeftSideForegroundBrush}"/>
      </Border>
      <Border x:Name="bdrRight"
      Height="Auto"
      Grid.Column="1"
      Background="{DynamicResource TextBoxBGBrush}"
      BorderBrush="{DynamicResource TextBoxBorderBrush}"
      BorderThickness="1,1,1,1"
      CornerRadius="0,3,3,0"/>
      <RichTextBox x:Name="rtbMain"
      HorizontalAlignment="Center"
      FontSize="{DynamicResource DefaultFontSize}"
      Height="Auto"
      BorderBrush="Transparent"
      Background="Transparent"
      Foreground="{DynamicResource DEFAULT_Font_Dark}"
      VerticalAlignment="Center"
      AcceptsReturn="False"
      AcceptsTab="False"
      Style="{DynamicResource ClearRichTextBoxStyle}"
      Grid.Column="1"
      Margin="0,3,0,3">
      <localControl:EnabledFlowDocument x:Name="efdMainDocument" PageWidth="{Binding ElementName=rtbMain, Path=ActualWidth}"/>
      </RichTextBox>
      </Grid>

      All the animations in the code are set to 00:00:00.00 However, when I add a UIElement or even text to the FlowDocument on startup, the text/uielement appear in the center of the flowdocument, then animate over to the left side where they should be. Is this a bug in WPF? I can't find anything in my code that would cause this.

      _ Offline
      _ Offline
      _iobuf
      wrote on last edited by
      #2

      Fixed: Set the RichTextBox HorizontalAlignment to Stretch

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups