This is a migrated thread and some comments may be shown as answers.

Resize HTMLPlaceHolder as per the text it containing

10 Answers 76 Views
HTMLPlaceHolder
This is a migrated thread and some comments may be shown as answers.
Anuraj Temkar
Top achievements
Rank 1
Anuraj Temkar asked on 05 Mar 2010, 04:29 PM

Hi, can anyone tell me how do i resize the HTMLPlaceHolder Control so that when i put some Text in it, it will not show any scroll to the HTMLPlaceHolder Control?? i mean i don’t want scrolls to the holder control. Instead I want to resize it according to the text in it. i used (ObjHTMLPlaceHolder.HtmlPresenter.Children[0] as HtmlElement).SetAttribute("scrolling", "no"); but did not work.
is there any way to get the height of HTMLPlaceHolder-Control's HtmlPresenter in Pixcel so that i can use it to set Height of the HTMLPlaceHolder Control

10 Answers, 1 is accepted

Sort by
0
Valentin.Stoychev
Telerik team
answered on 09 Mar 2010, 08:38 AM
Hi Anuraj Temkar,

It is supposed to work this way out of the box if you don't set the Width or Height attributes, unfortunately there is a problem with this that is logged here:
http://www.telerik.com/support/pits.aspx#/public/silverlight/269

Regards,
Valentin.Stoychev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Travis
Top achievements
Rank 1
answered on 07 Sep 2010, 07:18 PM
Has this been fixed yet, or is it still an Issue.  I have the same problem.
0
Tina Stancheva
Telerik team
answered on 10 Sep 2010, 05:19 PM
Hi Travis,

The issue isn't fixed yet. However, you can vote for it thus increasing its priority.

I hope this isn't a showstopper for you. Please accept our apology for the caused inconvenience.

Sincerely yours,
Tina Stancheva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Travis
Top achievements
Rank 1
answered on 13 Sep 2010, 04:12 PM
Unfortunately, it is a showstopper for me.  The html displayed needs to flex width and height attributes.  I've pretty much given up on the rad controls for editing and displaying HTML in silverlight apps.  I've instead decided to use a free control available here:
http://www.vectorlight.net/controls/rich_textbox.aspx

This editor is not as good in my opinion as what I've seen with most rad editors, but it does provide very basic HTML editing and does flex width and height correctly when displaying HTML.  It was also a bit easier for me to create a wrapper for this control.
0
Tina Stancheva
Telerik team
answered on 16 Sep 2010, 04:43 PM
Hello Travis,

I am sorry to hear that. Still, you say that you need a control to edit and display html content, so I was wondering if you have tried our RadRichTextBox. Here you can find more info about it.

With Telerik RadRichTextBox control you can load rich-text (XAML, HTML) or plain text (TXT) into the control, you can format and edit it and then export it back to plain text, XAML, Docx or Html formats. Read more

Please give the RadRichTextBox a try and let us know if it works for you. We will highly appreciate any feedback on it as well.

Kind regards,
Tina Stancheva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Travis
Top achievements
Rank 1
answered on 16 Sep 2010, 05:49 PM
Yes, I tried RadRichTextBox.  I eventually got it to work as far as editing goes.  It seemed like you have to do all this extra work  and add extra code to your xaml file to make it work for editing HTML.  The other problem was that the HTML that it created caused problems for the control I was using to display the HTML.  The display control was not a rad control.  The rad control for dispalying HTML doesn't work as stated previously in thist post.  I can't remember the exact details of the problem.  I think the display control wouldn't flex properly or something when it displayed the HTML that the RadRichTextBox created. 

I think Telerik needs to create an HTML editor for silverlight that actually works and doesn't involve so much tweaking.  Displaying everything in XAML just isn't an option.  I have too many apps that are not silverlight based that need to display content in HTML format. 
0
Mike
Telerik team
answered on 22 Sep 2010, 09:36 AM
Hi Travis,

Since RadHmlPlaceHolder controls wraps browser specific features it would not allow measuring of its content thus I am afraid precise automatic resizing is not possible. RadRichTextBox on the other hand has its own text rendering engine and supports automatic Height calculation based on its content. In the current version it has problems with automatic With calculation which we will address in the next release. We will be glad to know if you experience any other issues related to this new control.

Regarding you new control request, can you please elaborate a bit more on your scenario concerning HTML editing in Silverlight application?

Greetings,
Mike
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Travis
Top achievements
Rank 1
answered on 22 Sep 2010, 04:13 PM
Here's what I mean by tweaking: to get the richtextbox control to work for HTML you have to add this reference:

xmlns:documents="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Documents"
xmlns:documentsHtml="clr-namespace:Telerik.Windows.Documents.FormatProviders.Html;assembly=Telerik.Windows.Documents.FormatProviders.Html"

and then this:

<UserControl.Resources>
        <documentsHtml:HtmlDataProvider SetupDocument="HtmlDataProvider_SetupDocument" x:Key="htmlDataProvider" RichTextBox="{Binding ElementName=SystemDescRTB}" Html="{Binding ElementName=TBSystemDesc, Path=Text, Mode=TwoWay}" />
    </UserControl.Resources>

Additionally, you need to insert the RadRichTextBoxRibbonUI (I won't list the xaml this creates since it is so insanely long), a TextBox control which is what you actually bind to and then some more code in your code behind file so that your margins aren't screwed up:

 

 

 

private void HtmlDataProvider_SetupDocument(object sender, Telerik.Windows.Documents.FormatProviders.SetupDocumentEventArgs e)
       {
           e.Document.SectionDefaultPageMargin =
           new Telerik.Windows.Documents.Layout.Padding(10, 10, 10, 10); //set margins for HTML format, otherwise margins are skewed
           if (e.Document.Sections.First.Paragraphs.First != null)
           {
               e.Document.Sections.First.Paragraphs.First.FontSize = 13.33; //set font size to 10pt
           }
       }

 

 

I tried to create a wrapper that did all of this, but was having some issues making that work.  What I'm saying is that all of this should not be necessary.  All I should have to do is set some property in the radrichtextbox which says I want to edit in HTML mode. 


0
Mike
Telerik team
answered on 27 Sep 2010, 02:58 PM
Hi Travis,

The architecture of RadRichTextBox control and the related document format providers is designed to allow working with various input/output formats and different editing user experience (RbbonUI toolbars etc). It is also important to know that RadRichTextBox is not designed to be an HTML editor. Its internal document model resembles much more MS Word than HTML document.

In your case the best approach would be to create an user control that encapsulates all the logic if you wish to reuse it across the application. I prepared a project for you that demonstrates a possible approach to this.

Let me know if this helps.

Kind regards,
Mike
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Travis
Top achievements
Rank 1
answered on 27 Sep 2010, 03:49 PM
Thanks for the example.  I'll try it out.
Tags
HTMLPlaceHolder
Asked by
Anuraj Temkar
Top achievements
Rank 1
Answers by
Valentin.Stoychev
Telerik team
Travis
Top achievements
Rank 1
Tina Stancheva
Telerik team
Mike
Telerik team
Share this question
or