WPF RichTextBox Not Scrolling After Loading RTF FileRichTextBox (WPF) does not have string property “Text”Automatic vertical scroll bar in WPF TextBlock?Set RTF text into WPF RichTextBox controlRTF with Links in a RichTextBox WPFDoes my code demonstrate good WPF practice?WPF StackPanel autosizeWPF Richtextbox open RTF file as plain textHow to load a .rtf file in RichTextBox?WPF RichTextBox RTF update text?Navigate to other page IocContainers and MVVM light
Aragorn's "guise" in the Orthanc Stone
Delivering sarcasm
Why does the Sun have different day lengths, but not the gas giants?
How do you make your own symbol when Detexify fails?
It grows, but water kills it
Is this toilet slogan correct usage of the English language?
New brakes for 90s road bike
is this legal and f i dont come up with extra money is the deal off
Is it improper etiquette to ask your opponent what his/her rating is before the game?
How much character growth crosses the line into breaking the character
Loading commands from file
What should you do when eye contact makes your subordinate uncomfortable?
If infinitesimal transformations commute why dont the generators of the Lorentz group commute?
What does routing an IP address mean?
How to indicate a cut out for a product window
Store Credit Card Information in Password Manager?
Why is it that I can sometimes guess the next note?
Start making guitar arrangements
Why Shazam when there is already Superman?
Not using 's' for he/she/it
How should I respond when I lied about my education and the company finds out through background check?
Drawing ramified coverings with tikz
How could a planet have erratic days?
Is there a name for this algorithm to calculate the concentration of a mixture of two solutions containing the same solute?
WPF RichTextBox Not Scrolling After Loading RTF File
RichTextBox (WPF) does not have string property “Text”Automatic vertical scroll bar in WPF TextBlock?Set RTF text into WPF RichTextBox controlRTF with Links in a RichTextBox WPFDoes my code demonstrate good WPF practice?WPF StackPanel autosizeWPF Richtextbox open RTF file as plain textHow to load a .rtf file in RichTextBox?WPF RichTextBox RTF update text?Navigate to other page IocContainers and MVVM light
I am trying to load a Rich Text Format (RTF) file into a WPF RichTextBox. When I perform the load, it appears as though the file is getting loaded into the RichTextBox but the scroll bar is displayed without a visible slider box to scroll download. The scrollbar does not show the bottom arrow so it appears the bottom of the scrollbar is below the display area for the RichTextBox. This prevents a user from being able to scroll downward. I believe I am either missing a XAML property for the RichTextBox or something is not right with the way I am loading the RTF file. Please help. Thanks in advance.
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Grid.RowSpan="5"
Grid.Column="0" Grid.ColumnSpan="3"
VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<RichTextBox x:Name="LicenseRichTextBox" Margin="10"
VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
IsReadOnly="True" VerticalScrollBarVisibility="Visible">
</RichTextBox>
</StackPanel>
<StackPanel Grid.Row="6" Grid.Column="1" Grid.ColumnSpan="3" Margin="65,20,0,0" >
<Button x:Name="CloseButton" HorizontalAlignment="Left"
Width="90" Margin="-10,0,0,0"
Click="CloseButton_Click">
<StackPanel Orientation="Horizontal">
<Image Source="StaticResource CloseButtonImageKey"
Margin="5,0,0,0" Height="20" Width="20" />
<TextBlock Padding="5,0,0,0" VerticalAlignment="Center"><Run Text="Close"/></TextBlock>
</StackPanel>
</Button>
</StackPanel>
</Grid>
public void LoadRTF()
const string EULA_Dir = @"ResourcesEULAEUlA.RTF";
string currentDir = AppDomain.CurrentDomain.BaseDirectory;
string PathToEULA = currentDir + EULA_Dir;
if (File.Exists(PathToEULA))
LicenseRichTextBox.Selection.Load(new FileStream(PathToEULA, FileMode.Open), DataFormats.Rtf);
else
MessageBox.Show("Unable to locate the following file " + PathToEULA);
c# wpf xaml richtextbox
add a comment |
I am trying to load a Rich Text Format (RTF) file into a WPF RichTextBox. When I perform the load, it appears as though the file is getting loaded into the RichTextBox but the scroll bar is displayed without a visible slider box to scroll download. The scrollbar does not show the bottom arrow so it appears the bottom of the scrollbar is below the display area for the RichTextBox. This prevents a user from being able to scroll downward. I believe I am either missing a XAML property for the RichTextBox or something is not right with the way I am loading the RTF file. Please help. Thanks in advance.
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Grid.RowSpan="5"
Grid.Column="0" Grid.ColumnSpan="3"
VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<RichTextBox x:Name="LicenseRichTextBox" Margin="10"
VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
IsReadOnly="True" VerticalScrollBarVisibility="Visible">
</RichTextBox>
</StackPanel>
<StackPanel Grid.Row="6" Grid.Column="1" Grid.ColumnSpan="3" Margin="65,20,0,0" >
<Button x:Name="CloseButton" HorizontalAlignment="Left"
Width="90" Margin="-10,0,0,0"
Click="CloseButton_Click">
<StackPanel Orientation="Horizontal">
<Image Source="StaticResource CloseButtonImageKey"
Margin="5,0,0,0" Height="20" Width="20" />
<TextBlock Padding="5,0,0,0" VerticalAlignment="Center"><Run Text="Close"/></TextBlock>
</StackPanel>
</Button>
</StackPanel>
</Grid>
public void LoadRTF()
const string EULA_Dir = @"ResourcesEULAEUlA.RTF";
string currentDir = AppDomain.CurrentDomain.BaseDirectory;
string PathToEULA = currentDir + EULA_Dir;
if (File.Exists(PathToEULA))
LicenseRichTextBox.Selection.Load(new FileStream(PathToEULA, FileMode.Open), DataFormats.Rtf);
else
MessageBox.Show("Unable to locate the following file " + PathToEULA);
c# wpf xaml richtextbox
Can you show a screenshot? Also, click in the Rich Text Area and Scroll via Direction Keys or Mouse scroll - Does that work??
– Prateek Shrivastava
Mar 7 at 8:03
add a comment |
I am trying to load a Rich Text Format (RTF) file into a WPF RichTextBox. When I perform the load, it appears as though the file is getting loaded into the RichTextBox but the scroll bar is displayed without a visible slider box to scroll download. The scrollbar does not show the bottom arrow so it appears the bottom of the scrollbar is below the display area for the RichTextBox. This prevents a user from being able to scroll downward. I believe I am either missing a XAML property for the RichTextBox or something is not right with the way I am loading the RTF file. Please help. Thanks in advance.
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Grid.RowSpan="5"
Grid.Column="0" Grid.ColumnSpan="3"
VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<RichTextBox x:Name="LicenseRichTextBox" Margin="10"
VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
IsReadOnly="True" VerticalScrollBarVisibility="Visible">
</RichTextBox>
</StackPanel>
<StackPanel Grid.Row="6" Grid.Column="1" Grid.ColumnSpan="3" Margin="65,20,0,0" >
<Button x:Name="CloseButton" HorizontalAlignment="Left"
Width="90" Margin="-10,0,0,0"
Click="CloseButton_Click">
<StackPanel Orientation="Horizontal">
<Image Source="StaticResource CloseButtonImageKey"
Margin="5,0,0,0" Height="20" Width="20" />
<TextBlock Padding="5,0,0,0" VerticalAlignment="Center"><Run Text="Close"/></TextBlock>
</StackPanel>
</Button>
</StackPanel>
</Grid>
public void LoadRTF()
const string EULA_Dir = @"ResourcesEULAEUlA.RTF";
string currentDir = AppDomain.CurrentDomain.BaseDirectory;
string PathToEULA = currentDir + EULA_Dir;
if (File.Exists(PathToEULA))
LicenseRichTextBox.Selection.Load(new FileStream(PathToEULA, FileMode.Open), DataFormats.Rtf);
else
MessageBox.Show("Unable to locate the following file " + PathToEULA);
c# wpf xaml richtextbox
I am trying to load a Rich Text Format (RTF) file into a WPF RichTextBox. When I perform the load, it appears as though the file is getting loaded into the RichTextBox but the scroll bar is displayed without a visible slider box to scroll download. The scrollbar does not show the bottom arrow so it appears the bottom of the scrollbar is below the display area for the RichTextBox. This prevents a user from being able to scroll downward. I believe I am either missing a XAML property for the RichTextBox or something is not right with the way I am loading the RTF file. Please help. Thanks in advance.
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Grid.RowSpan="5"
Grid.Column="0" Grid.ColumnSpan="3"
VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<RichTextBox x:Name="LicenseRichTextBox" Margin="10"
VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
IsReadOnly="True" VerticalScrollBarVisibility="Visible">
</RichTextBox>
</StackPanel>
<StackPanel Grid.Row="6" Grid.Column="1" Grid.ColumnSpan="3" Margin="65,20,0,0" >
<Button x:Name="CloseButton" HorizontalAlignment="Left"
Width="90" Margin="-10,0,0,0"
Click="CloseButton_Click">
<StackPanel Orientation="Horizontal">
<Image Source="StaticResource CloseButtonImageKey"
Margin="5,0,0,0" Height="20" Width="20" />
<TextBlock Padding="5,0,0,0" VerticalAlignment="Center"><Run Text="Close"/></TextBlock>
</StackPanel>
</Button>
</StackPanel>
</Grid>
public void LoadRTF()
const string EULA_Dir = @"ResourcesEULAEUlA.RTF";
string currentDir = AppDomain.CurrentDomain.BaseDirectory;
string PathToEULA = currentDir + EULA_Dir;
if (File.Exists(PathToEULA))
LicenseRichTextBox.Selection.Load(new FileStream(PathToEULA, FileMode.Open), DataFormats.Rtf);
else
MessageBox.Show("Unable to locate the following file " + PathToEULA);
c# wpf xaml richtextbox
c# wpf xaml richtextbox
asked Mar 7 at 7:43
RobertcodeRobertcode
368214
368214
Can you show a screenshot? Also, click in the Rich Text Area and Scroll via Direction Keys or Mouse scroll - Does that work??
– Prateek Shrivastava
Mar 7 at 8:03
add a comment |
Can you show a screenshot? Also, click in the Rich Text Area and Scroll via Direction Keys or Mouse scroll - Does that work??
– Prateek Shrivastava
Mar 7 at 8:03
Can you show a screenshot? Also, click in the Rich Text Area and Scroll via Direction Keys or Mouse scroll - Does that work??
– Prateek Shrivastava
Mar 7 at 8:03
Can you show a screenshot? Also, click in the Rich Text Area and Scroll via Direction Keys or Mouse scroll - Does that work??
– Prateek Shrivastava
Mar 7 at 8:03
add a comment |
1 Answer
1
active
oldest
votes
Wild guess - your RichTextBox is inside a StackPanel. Stack panels do not constrain their children, instead they have infinite internal space and grow according to their child content. So your text box isn't being constrained, so it doesn't think it needs to show a scrollbar.
Not in front of a dev environment at the moment so I can't confirm this but try taking it out of the StackPanel and see what that does.
MarcE you are right on target. Yes that was the problem. Soon as I took the RichTextBox out of the <StackPanel> the scrollbar began working properly and looking correct. The RichTextBox is looking and working fine now. I hope to remember this for future problems. Thanks a million.
– Robertcode
Mar 7 at 8:18
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55038496%2fwpf-richtextbox-not-scrolling-after-loading-rtf-file%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Wild guess - your RichTextBox is inside a StackPanel. Stack panels do not constrain their children, instead they have infinite internal space and grow according to their child content. So your text box isn't being constrained, so it doesn't think it needs to show a scrollbar.
Not in front of a dev environment at the moment so I can't confirm this but try taking it out of the StackPanel and see what that does.
MarcE you are right on target. Yes that was the problem. Soon as I took the RichTextBox out of the <StackPanel> the scrollbar began working properly and looking correct. The RichTextBox is looking and working fine now. I hope to remember this for future problems. Thanks a million.
– Robertcode
Mar 7 at 8:18
add a comment |
Wild guess - your RichTextBox is inside a StackPanel. Stack panels do not constrain their children, instead they have infinite internal space and grow according to their child content. So your text box isn't being constrained, so it doesn't think it needs to show a scrollbar.
Not in front of a dev environment at the moment so I can't confirm this but try taking it out of the StackPanel and see what that does.
MarcE you are right on target. Yes that was the problem. Soon as I took the RichTextBox out of the <StackPanel> the scrollbar began working properly and looking correct. The RichTextBox is looking and working fine now. I hope to remember this for future problems. Thanks a million.
– Robertcode
Mar 7 at 8:18
add a comment |
Wild guess - your RichTextBox is inside a StackPanel. Stack panels do not constrain their children, instead they have infinite internal space and grow according to their child content. So your text box isn't being constrained, so it doesn't think it needs to show a scrollbar.
Not in front of a dev environment at the moment so I can't confirm this but try taking it out of the StackPanel and see what that does.
Wild guess - your RichTextBox is inside a StackPanel. Stack panels do not constrain their children, instead they have infinite internal space and grow according to their child content. So your text box isn't being constrained, so it doesn't think it needs to show a scrollbar.
Not in front of a dev environment at the moment so I can't confirm this but try taking it out of the StackPanel and see what that does.
answered Mar 7 at 8:10
MarcEMarcE
2,88611626
2,88611626
MarcE you are right on target. Yes that was the problem. Soon as I took the RichTextBox out of the <StackPanel> the scrollbar began working properly and looking correct. The RichTextBox is looking and working fine now. I hope to remember this for future problems. Thanks a million.
– Robertcode
Mar 7 at 8:18
add a comment |
MarcE you are right on target. Yes that was the problem. Soon as I took the RichTextBox out of the <StackPanel> the scrollbar began working properly and looking correct. The RichTextBox is looking and working fine now. I hope to remember this for future problems. Thanks a million.
– Robertcode
Mar 7 at 8:18
MarcE you are right on target. Yes that was the problem. Soon as I took the RichTextBox out of the <StackPanel> the scrollbar began working properly and looking correct. The RichTextBox is looking and working fine now. I hope to remember this for future problems. Thanks a million.
– Robertcode
Mar 7 at 8:18
MarcE you are right on target. Yes that was the problem. Soon as I took the RichTextBox out of the <StackPanel> the scrollbar began working properly and looking correct. The RichTextBox is looking and working fine now. I hope to remember this for future problems. Thanks a million.
– Robertcode
Mar 7 at 8:18
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55038496%2fwpf-richtextbox-not-scrolling-after-loading-rtf-file%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Can you show a screenshot? Also, click in the Rich Text Area and Scroll via Direction Keys or Mouse scroll - Does that work??
– Prateek Shrivastava
Mar 7 at 8:03