HtmlPlaceHolder with Silverlight Scrollviewer

6 posts, 1 answers
  1. Muthu
    Muthu avatar
    8 posts
    Member since:
    Dec 2011

    Posted 14 Dec 2011 Link to this post

    I am trying to use HtmlPlaceHolder with Silverlight ScollViewer. Please Help
  2. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 19 Dec 2011 Link to this post

    Hello Muthu,

    I am not sure what is your scenario and how would you like to integrate the two controls. Basically you can wrap the RadHtmlPlaceholder in a ScrollViewer control but you need to keep in mind that an element with no explicitly set size would not stretch within a ScrollViewer since it provides infinitely large space to its children.
    This is why you can either set explicit size to the HtmlPlaceholder when used in a ScrollViewer, or not place it in a ScrollViewer, since if there is not enough available space for rendering its content, the HtmlPlaceholder will automatically show its built-in ScrollViewer.

    Also if you've encountered any specific issues with placing the HtmlPlaceholder in a ScrollViewer, please let us know so that we can look into that and further assist you.

    Best wishes,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
  4. Muthu
    Muthu avatar
    8 posts
    Member since:
    Dec 2011

    Posted 19 Dec 2011 Link to this post

    Hi Tina,

    I have tried using only the HtmlPlaceHolder without Scrollviewer, but when the space is not enough to display the rendered content, it shows a default html scrollbar. It degrades the look and feel of a Rich Internet Application. Kindly suggest a resolution.

    Thanks,
    Muthu
  5. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 19 Dec 2011 Link to this post

    Hello Muthu,

    Thank you for getting back to us. Have you encountered any issues while displaying the RadHtmlPlaceholder in the Silverlight ScrollViewer or am I missing something from your scenario?

    Also, can you share with us what content you're displaying in the HtmlPlaceholder?

    All the best,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  6. Muthu
    Muthu avatar
    8 posts
    Member since:
    Dec 2011

    Posted 19 Dec 2011 Link to this post

    Hi Tina,

    Below is the xaml code i m writing,

    <Grid>

            <Grid.RowDefinitions>

                <RowDefinition Height="Auto"/>

                <RowDefinition Height="*"/>

            </Grid.RowDefinitions>

            <Button Grid.Row="0" Height="34" HorizontalAlignment="Center" Margin="20" Click="Button_Click"

                    Content="Set the Source of the RadHTMLPlaceHolder" VerticalAlignment="Top"

                    Width="290" />

            <ScrollViewer HorizontalAlignment="Stretch" Height="700" Width="400" VerticalAlignment="Stretch" Grid.Row="1" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">

                <telerik:RadHtmlPlaceholder HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="Silver" x:Name="html"/>

            </ScrollViewer>

        </Grid>

     
    In Button_click i wrote 
    html.SourceUrl = new Uri("http://en.wikipedia.org/wiki/Listeriosis");


    I would like to set height and width to ScrollViewer, not for the RadHtmlPlaceHolder.

    Since the radHtmlPlaceHolder has no explicit height and Width i am getting the screen as the one attached.

    Thanks,
    Muthu
  7. Answer
    Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 22 Dec 2011 Link to this post

    Hello Muthu,

    Since in a ScrollViewer control an element with no explicitly set size would not stretch within a ScrollViewer since it provides infinitely large space to its children.

    This is why if you want to stretch the RadHtmlPlaceholder to takes up the ScrollViewer size and control only the ScrollViewer size, you can bind the RadHtmlPlaceholder Width and Height properties to the Width/Height properties of the ScrollViewer.
    <ScrollViewer Name="scrollViewer"
                    Grid.Row="1"
                    Width="400"
                    Height="700"
                    HorizontalAlignment="Stretch"
                    VerticalAlignment="Stretch" HorizontalScrollBarVisibility="Visible">
     
        <telerik:RadHtmlPlaceholder x:Name="html"
                Width="{Binding ElementName=scrollViewer,Path=Width}"
                Height="{Binding ElementName=scrollViewer,Path=Height}"
                Background="Silver" />
     
    </ScrollViewer>


    All the best,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top
DevCraft banner