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

RadWindow Not Wrapping Text in a TextBlock

4 Answers 135 Views
Window
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Warren
Top achievements
Rank 1
Warren asked on 12 May 2011, 09:50 PM
I am using a DataTemplate that has a TextBlock defined with TextWrapping="Wrap" defined.  When I test this datatemplate in a normal .XAML page it displays everything fine with the TextBlock wrapping text properly.  When I use this datatemplate in a RadWindow none of the textblocks wrap text properly and just go off the screen.

I should also point out that I am calling the RadWindow from within a RadJumpList ItemTap.

DataTemplate:
<DataTemplate x:Name="ContentTemplate">
    <Border Padding="10, 10, 10, 10">
        <Grid Margin="0, 0, 0, 0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid Grid.Column="0" Margin="0, 0, 0, 0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <StackPanel Orientation="Vertical" Grid.Row="0" Margin="0, 0, 0, 0">
                    <StackPanel Orientation="Horizontal">
                        <Image Source="{Binding ImagePath}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="8, 0, 10, 0"/>
                        <TextBlock Text="{Binding State}" FontSize="{StaticResource PhoneFontSizeMedium}" VerticalAlignment="Center" FontWeight="SemiBold" Margin="8, 0, 8, 0" Foreground="{Binding Foreground}"/>
                        <Rectangle VerticalAlignment="Stretch" Width="1" Fill="{StaticResource PhoneSubtleBrush}" Margin="0, 3, 8, 3"/>
                        <TextBlock Text="{Binding ProcessId}" FontSize="15" VerticalAlignment="Center" Margin="8, 0, 8, 0" Foreground="{StaticResource PhoneSubtleBrush}"/>
                    </StackPanel>
                    <TextBlock Text="{Binding Caption}" TextWrapping="Wrap" FontSize="16" FontWeight="Bold"  VerticalAlignment="Center" Margin="8, 8, 8, 5"/>
                    <TextBlock Text="{Binding Server}" TextWrapping="Wrap" FontSize="15" VerticalAlignment="Center" Margin="8, 0, 8, 0"/>
                    <TextBlock Text="{Binding Name}" FontSize="15" VerticalAlignment="Center" Margin="8, 0, 8, 0" Foreground="{StaticResource PhoneSubtleBrush}"/>
                    <TextBlock Text="{Binding StartMode}" FontSize="15" VerticalAlignment="Center" Margin="8, 0, 8, 0" Foreground="{StaticResource PhoneSubtleBrush}"/>
                    <TextBlock Text="{Binding StartName}" FontSize="15" VerticalAlignment="Center" Margin="8, 0, 8, 0" Foreground="{StaticResource PhoneSubtleBrush}"/>
                    <TextBlock Text="{Binding PathName}" TextWrapping="Wrap" FontSize="15" VerticalAlignment="Center" Margin="8, 0, 8, 0" Foreground="{StaticResource PhoneSubtleBrush}"/>
                    <TextBlock Text="{Binding Description}"  Width="Auto" TextWrapping="Wrap" FontSize="15" VerticalAlignment="Center" Margin="10, 0, 10, 0" Foreground="{StaticResource PhoneSubtleBrush}"/>
                </StackPanel>
            </Grid>
        </Grid>
    </Border>
</DataTemplate>

RadWindow XAML:
<telerikPrimitives:RadWindow x:Name="radWindowServiceInfo" IsFullScreen="True"
    <telerikPrimitives:RadWindow.ApplicationBarInfo
        <telerikPrimitives:ApplicationBarInfo ButtonClick="radWindowAppBar_ButtonClick"
            <telerikPrimitives:ApplicationBarButton IconUri="/Images/back.png" Text="Back" /> 
        </telerikPrimitives:ApplicationBarInfo
    </telerikPrimitives:RadWindow.ApplicationBarInfo
</telerikPrimitives:RadWindow


Code behind that sets stuff:
Private Sub radJumpList_ItemTap(sender As Object, e As Telerik.Windows.Controls.ListBoxItemTapEventArgs) Handles RadJumpList.ItemTap
    If Not radWindowServiceInfo.IsOpen Then
        Dim jumpList As RadJumpList = sender
        Dim animation As New RadScaleAndMoveAnimation
        With radWindowServiceInfo
            .IsFullScreen = True
            .IsAnimationEnabled = True
            .OpenAnimation = animation
            .CloseAnimation = animation.CreateOpposite
            .PlacementTarget = radJumpList
        End With
        If appSettings.GetServicesSlimSetting Then
            Dim selectedItem = CType(jumpList.SelectedItem, ServiceInfoSlim)
            With radWindowServiceInfo
                .Content = selectedItem
                .ContentTemplate = ContentTemplateSlim
                .IsOpen = True
            End With
        Else
            Dim selectedItem = CType(jumpList.SelectedItem, ServiceInfo)
            With radWindowServiceInfo
                .Content = selectedItem
                .ContentTemplate = ContentTemplate
                .IsOpen = True
            End With
        End If
    End If
End Sub


4 Answers, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 17 May 2011, 02:02 PM
Hello Warren,

Thank you for writing.
This is a bug in RadWindow which will be fixed in the next internal build. The build will be available next week on Wednesday. Currently you can work around it by setting the Content of RadWindow to a ContentControl and then set the Content property of this ContentControl to the SelectedItem of the jumpList. The ControlTemplate should also be set the ContentControl instance.

Your feedback is greatly appreciated. Please write again if you need assistance with our controls.

Greetings,
Victor
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Warren
Top achievements
Rank 1
answered on 01 Jun 2011, 06:28 AM
I just downloaded build 516 and this bug still exists.

Using a ContentControl did not fix the issue either.
0
Victor
Telerik team
answered on 07 Jun 2011, 07:06 AM
Hi Warren,

 Thank you for writing.

The fix was added to the internal build after the last one, this is why it is not included in the latest internal build. If this issue is critical for you, we'd be happy to provide another internal build.
I am looking forward to your reply.

Kind regards,
Victor
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Zik
Top achievements
Rank 2
answered on 18 Jun 2012, 03:37 AM
I'm having an issue with this in the 2012 Q2 release.  The text fits on one line but it is pushing the surrounding border off the screen.  Here is my window:
<telerikPrimitives:RadModalWindow Name="ChangeSnoozeDuration" Placement="CenterCenter"
                     PlacementTarget="{Binding ElementName=LayoutRoot}"
                     IsClosedOnBackButton="True">
    <Border BorderBrush="{StaticResource PhoneForegroundBrush}" BorderThickness="3" CornerRadius="3"
         Background="{StaticResource PhoneBackgroundBrush}">
        <StackPanel Margin="12">
            <TextBlock Style="{StaticResource PhoneTextNormalStyle}" Text="{Binding Resources.AlarmTrigger_ChangeSnoozeMsg1}"
                   FontSize="{StaticResource PhoneFontSizeMedium}" TextWrapping="Wrap" />
            <TextBlock Name="ChangeSnoozeMessage" Style="{StaticResource PhoneTextNormalStyle}"
                   FontSize="{StaticResource PhoneFontSizeMedium}" Text="A" />
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                <Button Margin="12,24" Width="180" Content="{Binding Resources.MessageBox_Yes}" Click="ChangeSnoozeYes_Click" />
                <Button Margin="12,24" Width="180" Content="{Binding Resources.MessageBox_No}" Click="ChangeSnoozeNo_Click" />
            </StackPanel>
            <ProgressBar Margin="0,0,0,24" Name="ChangeSnoozeTimeoutProgressBar" Maximum="100" Minimum="0" />
        </StackPanel>
    </Border>
</telerikPrimitives:RadModalWindow>

The first text block is long enough such that the text fits on the page without wrapping but the border disappears off the edge (both left and right).  The second text block is built in the code-behind and isn't long enough to require wrapping.  Originally I had both of these text blocks as a single text block but the text did not wrap, and I thought maybe it was because the text was set in code-behind.  So I broke it into two text blocks but the first one is still just long enough that it should wrap but doesn't.  I have tried increasing the margin of both the stack panel and the text block (to get it to wrap) but it simply pushes the border off screen even more.

EDIT:  Never mind, I found something that works.  In the code-behind I set WindowSize = new Size((App.Current as App).RootFrame.ActualWidth, double.NaN) and now the text wraps properly.
Tags
Window
Asked by
Warren
Top achievements
Rank 1
Answers by
Victor
Telerik team
Warren
Top achievements
Rank 1
Zik
Top achievements
Rank 2
Share this question
or