Export InlineUIContainer with RadRichTextBox Inside

4 posts, 0 answers
  1. Tyson
    Tyson avatar
    9 posts
    Member since:
    Apr 2007

    Posted 01 Jun 2012 Link to this post

    I have a RadRichTextBox with an InlineUIContainer that hosts a RadExpander. In the RadExpander is another RadRichTextBox. As long as the expander does not house a RadRichTextBox, the export to xaml works fine. If the RadExpander houses a RadRichTextBox, then the export hangs. 

    <Grid Height="500" Name="gridRadRtbParent">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <telerik:DocumentRuler AssociatedRichTextBox="{Binding ElementName=rtb}" Grid.Row="1" />
                <telerik:RadRichTextBox Grid.Row="1" HorizontalAlignment="Stretch" IsContextMenuEnabled="True" IsSelectionMiniToolBarEnabled="True" IsSpellCheckingEnabled="True" LayoutMode="Flow" Margin="24,24,0,0" Name="rtb" VerticalAlignment="Stretch">
                    <telerik:RadDocument>
     
                        <telerik:Section>
                            <telerik:Paragraph>
                                <telerik:Span Text="Some text before expander"/>
                            </telerik:Paragraph>
                        </telerik:Section>
     
                        <telerik:Section>
                            <telerik:Paragraph>
                                <telerik:InlineUIContainer>
                                    <telerik:RadExpander x:Name="expander2" SizeChanged="expander_SizeChanged">
                                        <telerik:RadRichTextBox x:Name="rtbChild2" >
                                            <telerik:RadDocument>
     
                                                <telerik:Section>
                                                    <telerik:Paragraph>
                                                        <telerik:Span Text="Some text Inside expander"/>
                                                    </telerik:Paragraph>
                                                </telerik:Section>
     
     
                                                <telerik:Section>
                                                    <telerik:Paragraph>
                                                        <telerik:Span Text="Some more text Inside expander"/>
                                                    </telerik:Paragraph>
     
                                                </telerik:Section>
     
     
                                            </telerik:RadDocument>
                                        </telerik:RadRichTextBox>
                                    </telerik:RadExpander>
                                </telerik:InlineUIContainer>
                            </telerik:Paragraph>
                        </telerik:Section>
                        <telerik:Section>
                            <telerik:Paragraph>
                                <telerik:Span Text="Some text after expander"/>
                            </telerik:Paragraph>
     
                        </telerik:Section>
     
     
                    </telerik:RadDocument>
                </telerik:RadRichTextBox>
                <telerik:RadRichTextBoxRibbonUI BackstageClippingElement="{Binding ElementName=gridRadRtbParent}" CollapseThresholdSize="50,50" DataContext="{Binding Path=Commands, ElementName=rtb}">

    Does anyone have any idea why this would hang my browser when the expander houses a radrichtextbox?

    Thanks,
  2. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 05 Jun 2012 Link to this post

    Hello Tyson,

    The main purpose of InlineUIContainers is for representation only - i.e. to be able to insert custom controls in the document without serializing and deserializing them. XamlFormatProvider can handle the task of serialization and deserialization of smaller controls, but  is not suited to be used with more complex controls like RadRichTextBox or custom controls. This is due to the fact that such controls include a lot of public properties that are necessary for their successful deserialization and will be included in the output (the reason for the "hang" in your application).

    We are considering providing XamlExportSettings in order to allow control over the export of InlineUIContainers. In that regard, could you provide some more details on your use-case and the reason why you are embedding RadRichTextBox in RadExpander in the document.

    All the best,
    Iva Toteva
    the Telerik team

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

  3. DevCraft banner
  4. Tyson
    Tyson avatar
    9 posts
    Member since:
    Apr 2007

    Posted 05 Jun 2012 Link to this post

    There are several considerations.
    • We have several configurations for displaying detail data (as well as list data) to the user depending on their customer affiliation as well as there specific permissions. To solve this, we store layout configurations for both grids and detail templates. The goal is to have a detail template laid out using an interface that will allow the business to lay out the configuration and see what it is going to look like ahead of time.
    • We want our users to be able to copy data from the UI, including whatever portions of the page they wish to copy. The Silverlight UI will not by default allow a user to do this, but a rich text box will.
    • We need to be able to serialize and deserialize the configuration to and from the database so that we can get it at runtime and use it to display dynamic data to the end user.
    • We need to have collapsible sections in the detail configuration to allow the user to show / hide information that may or may not be pertinent to what they are currently looking at in the detail record. For instance, they may not be conserned with information regarding the delivery information of a shipment, but only concerned with the origin of it. Thus, using RadExpander inside of the rich text box seemed like a good solution. The problem with this is that anything inside the RadExpander will not be editable like the rest of the detail page (or at least not serializable to the database as it cannot be exported)

    Now using the RichTextBox to allow serialization of the xaml, and using supported functionality, would there be a way to make it appear as if a section of the RadRichTextBox were collapsing or expanding depending on a click in the document? For instance, can I make a Section appear and dissapear while preserving the content of the Section?

    Or better alternative would be to somehow override the Export / Import of a particular InlineUIContainer if it is housing a control of a particular type. In this way I could parse the control and create my own xaml to be include in the export procedure, and during import be able to recreate the appropriate controls onto the document.

    Housing the RadExpander with a RadRichTextBox inside seems to work like a champ, it's just the export that looks to have issues. Any ideas would be greatly appreciated.

    Thanks,
    Tyson

  5. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 07 Jun 2012 Link to this post

    Hello Tyson, 

    Thank you for the follow-up and for providing such detailed information on your use-case.

    Overall, the scenario you have described has not been considered and targeted. Currently it is not possible to implement it. In general, using RadRichTextBox as a container of other elements and simulating collapsible regions in the document using RadExpander is kind of a hack.

    However, will probably add XAML ExportSettings and ImportSettings in one of the upcoming releases, which will allow the serialization and deserialization of the document when there are inline UI containers.
    Regards,
    Iva Toteva
    the Telerik team

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

Back to Top