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

TextBox to grow vertically instead of scroll horizontally

1 Answer 163 Views
ConversationView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Andrew
Top achievements
Rank 1
Andrew asked on 12 Sep 2013, 03:53 AM
When typing long messages in the conversation view, the text box awkwardly scrolls to the right. I want it to grow taller instead (to the extent possible) the way the Windows Phone Messaging app does. How can I make it do this?

1 Answer, 1 is accepted

Sort by
0
Accepted
Todor
Telerik team
answered on 12 Sep 2013, 07:00 AM
Hello Andrew,

Thank you for your question.

You need to modify the text box template so that it supports TextWrapping. Here's the template you need:

<DataTemplate x:Key="TextBoxTemplate">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="3*"/>
        </Grid.ColumnDefinitions>
 
        <telerikPrimitivesPrimitives:RadPointerContentControl
            Grid.Column="1"
            TargetPoint="160, 300">
            <telerikPrimitivesPrimitives:RadPointerContentControl.PointerTemplate>
                <DataTemplate>
                    <Polygon
                        Width="12"
                        Height="24"
                        Points="0,0 12,0 12,12"
                        StrokeThickness="0"
                        RenderTransformOrigin="0.5, 0.5"/>
                </DataTemplate>
            </telerikPrimitivesPrimitives:RadPointerContentControl.PointerTemplate>
 
            <telerikPrimitives:RadTextBox
                x:Name="PART_TextBox"
                TextWrapping="Wrap"
                ActionButtonVisibility="Visible"
                Margin="0, 0, -12, 0">
                <telerikPrimitives:RadTextBox.ActionButtonStyle>
                    <Style TargetType="telerikPrimitives:RadImageButton">
                        <Setter
                            Property="ButtonType"
                            Value="Custom"/>
                        <Setter
                            Property="RestStateImageSource"
                            Value="/Telerik.Windows.Controls.Data;component/ConversationView/Images/SendIcon.png"/>
                    </Style>
                </telerikPrimitives:RadTextBox.ActionButtonStyle>
            </telerikPrimitives:RadTextBox>
        </telerikPrimitivesPrimitives:RadPointerContentControl>
    </Grid>
</DataTemplate>

The TextWrapping is highlighted, it is not part of the default template, but you will need it in order to prevent the text box from scrolling to the right. Here are the prefixes that are used:

xmlns:telerikData="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Data"
xmlns:telerikPrimitives="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Primitives"
xmlns:telerikPrimitivesPrimitives="clr-namespace:Telerik.Windows.Controls.Primitives;assembly=Telerik.Windows.Controls.Primitives"

Now just make sure that your ConversationView uses the template that you've just added:

<telerikData:RadConversationView TextBoxTemplate="{StaticResource TextBoxTemplate}" />

Let us know if you need further assistance.
 
Regards,
Todor
Telerik
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
Tags
ConversationView
Asked by
Andrew
Top achievements
Rank 1
Answers by
Todor
Telerik team
Share this question
or