Auto Resizing Problem

1 posts, 0 answers
  1. Marcin
    Marcin avatar
    165 posts
    Member since:
    Jan 2011

    Posted 11 Oct 2012 Link to this post

    I have following window:

    <telerik:RadWindow x:Class="IdealHost.FaceToFace.Controls.MessageBox" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" MinHeight="140" MinWidth="300"
                       WindowStartupLocation="CenterOwner" ResizeMode="NoResize"  >
     
    <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="80" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
     
            <TextBlock VerticalAlignment="Center" HorizontalAlignment="Stretch" Grid.Row="0" Grid.Column="1" Margin="15,10,15,10" Name="txtMessage" />
     
              </Grid>
    </telerik:RadWindow>

    When I'm assigning text using following code:

    this.txtMessage.Text = message;

    The window is propery resized to size of text.

    But when I change TexBlock to use Binding:

    <TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Row="0" Grid.Column="1" Margin="15,10,15,10" Text="{Binding Message}"/>

    The window is not automatically resizing. And text is cut.

    How can I fix this issue? I realy would like to use binding not direct code.
Back to Top