Multiline message

6 posts, 1 answers
  1. Alessio
    Alessio avatar
    6 posts
    Member since:
    Jun 2013

    Posted 18 Feb 2014 Link to this post

    Hi

    i have a message too long for the tile, so i wan't it go automatically on new line like textview.
    How can i do that? if i add a new line char it go to new line, but i wanna do it automatically.

    Tnx in advance!
  2. Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 20 Feb 2014 Link to this post

    Hello Alessio,

    Make sure the text-wrapping function of the TextBlock is turned on.

    Regards,
    Deyan
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peek previews directly from the developers working on the UI for Windows Phone, subscribe to the blog feed now.
  3. DevCraft banner
  4. Alessio
    Alessio avatar
    6 posts
    Member since:
    Jun 2013

    Posted 20 Feb 2014 in reply to Deyan Link to this post

    tnx for your response, how can i set it to the textBlock of the Message part of the hubtile?

    Tnx
  5. Answer
    Victor
    Admin
    Victor avatar
    1351 posts

    Posted 25 Feb 2014 Link to this post

    Hello Alessio,

    In order to make the text multi-line you will have to edit the control template of your tile. Here is the default template of RadHubTile:
    <Style TargetType="telerikPrimitives:RadHubTile"
           BasedOn="{StaticResource BaseHubTileStyle}">
        <Setter Property="Padding"
                Value="12"/>
        <Setter Property="FontSize"
                Value="50"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="telerikPrimitives:RadHubTile">
                    <Grid x:Name="PART_LayoutRoot">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup>
                                <VisualStateGroup.Transitions>
                                    <VisualTransition From="NotFlipped"
                                                          To="Flipped">
                                        <Storyboard>
                                            <DoubleAnimation Storyboard.TargetProperty="RotationX"
                                                             Storyboard.TargetName="FrontProjection"
                                                             Duration="0:0:0.4"
                                                             From="0"
                                                             To="90"/>
                                            <DoubleAnimation Storyboard.TargetProperty="RotationX"
                                                             Storyboard.TargetName="BackProjection"
                                                             Duration="0:0:0.4"
                                                             BeginTime="0:0:0.4"
                                                             From="-90"
                                                             To="0"/>
                                        </Storyboard>
                                    </VisualTransition>
     
                                    <VisualTransition From="Flipped"
                                                          To="NotFlipped">
                                        <Storyboard>
                                            <DoubleAnimation Storyboard.TargetProperty="RotationX"
                                                             Storyboard.TargetName="FrontProjection"
                                                             Duration="0:0:0.4"
                                                             BeginTime="0:0:0.4"
                                                             From="-90"
                                                             To="0"/>
                                            <DoubleAnimation Storyboard.TargetProperty="RotationX"
                                                             Storyboard.TargetName="BackProjection"
                                                             Duration="0:0:0.4"
                                                             From="0"
                                                             To="90"/>
                                        </Storyboard>
                                    </VisualTransition>
                                </VisualStateGroup.Transitions>
     
                                <VisualState x:Name="Flipped">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="RotationX"
                                                             Storyboard.TargetName="FrontProjection">
                                            <DiscreteDoubleKeyFrame KeyTime="0"
                                                                    Value="90"/>
                                        </DoubleAnimationUsingKeyFrames>
     
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="RotationX"
                                                             Storyboard.TargetName="BackProjection">
                                            <DiscreteDoubleKeyFrame KeyTime="0"
                                                                    Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
     
                                <VisualState x:Name="NotFlipped">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="RotationX"
                                                             Storyboard.TargetName="FrontProjection">
                                            <DiscreteDoubleKeyFrame KeyTime="0"
                                                                    Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
     
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="RotationX"
                                                             Storyboard.TargetName="BackProjection">
                                            <DiscreteDoubleKeyFrame KeyTime="0"
                                                                    Value="-90"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
     
                        <Grid>
                            <Border Background="{TemplateBinding Background}"
                                    BorderThickness="0"
                                    x:Name="PART_Background">
                                <StackPanel Orientation="Horizontal"
                                            HorizontalAlignment="Center">
                                    <Image Source="{TemplateBinding ImageSource}"
                                           Stretch="None"/>
     
                                    <ContentControl x:Name="PART_Notification"
                                                    HorizontalAlignment="Left"
                                                    VerticalAlignment="Center"
                                                    Content="{TemplateBinding Count}"
                                                    FontStretch="{TemplateBinding FontStretch}"
                                                    FontStyle="{TemplateBinding FontStyle}"
                                                    FontWeight="{TemplateBinding FontWeight}"
                                                    FontFamily="{TemplateBinding FontFamily}"
                                                    FontSize="{TemplateBinding FontSize}"
                                                    Margin="8, 0, 0, 0"/>
                                </StackPanel>
                            </Border>
     
                            <ContentControl x:Name="PART_Message"
                                            HorizontalAlignment="Left"
                                            VerticalAlignment="Top"
                                            FontSize="{StaticResource PhoneFontSizeNormal}"
                                            Content="{TemplateBinding Message}"
                                            Margin="{TemplateBinding Padding}"/>
                            <ContentControl x:Name="PART_Title"
                                            HorizontalAlignment="Left"
                                            VerticalAlignment="Bottom"
                                            FontSize="{StaticResource PhoneFontSizeNormal}"
                                            Content="{TemplateBinding Title}"
                                            Margin="{TemplateBinding Padding}"/>
                            <Grid.Projection>
                                <PlaneProjection x:Name="FrontProjection"/>
                            </Grid.Projection>
                        </Grid>
     
                        <ContentControl FontSize="{StaticResource PhoneFontSizeNormal}"
                                        HorizontalContentAlignment="Stretch"
                                        VerticalContentAlignment="Stretch">
                            <ContentPresenter x:Name="PART_BackContent"
                                              Content="{TemplateBinding BackContent}"
                                              ContentTemplate="{TemplateBinding BackContentTemplate}">
                                <ContentPresenter.Projection>
                                    <PlaneProjection x:Name="BackProjection"/>
                                </ContentPresenter.Projection>
                            </ContentPresenter>
                        </ContentControl>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    Notice the PART_Message ContentControl. You need to replace this with a TextBlock but only if your content is always text. After you replace it you can set the new TextBlock to be multi-line.

    Please clarify which hub tile you are using so that I can give you the correct control template if necessary.

    Regards,
    Victor
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peek previews directly from the developers working on the UI for Windows Phone, subscribe to the blog feed now.
  6. Alessio
    Alessio avatar
    6 posts
    Member since:
    Jun 2013

    Posted 25 Feb 2014 in reply to Victor Link to this post

    Tnx it works perfectly!!!
  7. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 26 Feb 2014 Link to this post

    Awesome :).

    Regards,
    Victor
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peek previews directly from the developers working on the UI for Windows Phone, subscribe to the blog feed now.
Back to Top
DevCraft banner