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

Multiline message

5 Answers 44 Views
HubTile
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Alessio
Top achievements
Rank 1
Alessio asked on 18 Feb 2014, 09:34 AM
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!

5 Answers, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 20 Feb 2014, 10:56 AM
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.
0
Alessio
Top achievements
Rank 1
answered on 20 Feb 2014, 02:30 PM
tnx for your response, how can i set it to the textBlock of the Message part of the hubtile?

Tnx
0
Accepted
Victor
Telerik team
answered on 25 Feb 2014, 04:05 PM
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.
0
Alessio
Top achievements
Rank 1
answered on 25 Feb 2014, 04:40 PM
Tnx it works perfectly!!!
0
Victor
Telerik team
answered on 26 Feb 2014, 02:44 PM
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.
Tags
HubTile
Asked by
Alessio
Top achievements
Rank 1
Answers by
Deyan
Telerik team
Alessio
Top achievements
Rank 1
Victor
Telerik team
Share this question
or