RadWindow Not Wrapping Text in a TextBlock

5 posts, 0 answers
  1. Warren
    Warren avatar
    9 posts
    Member since:
    Mar 2011

    Posted 12 May 2011 Link to this post

    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


  2. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 17 May 2011 Link to this post

    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>>
  3. DevCraft banner
  4. Warren
    Warren avatar
    9 posts
    Member since:
    Mar 2011

    Posted 01 Jun 2011 Link to this post

    I just downloaded build 516 and this bug still exists.

    Using a ContentControl did not fix the issue either.
  5. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 07 Jun 2011 Link to this post

    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>>
  6. Zik
    Zik avatar
    18 posts
    Member since:
    Mar 2012

    Posted 17 Jun 2012 Link to this post

    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.
Back to Top
DevCraft banner