Grow in height

Topics: question
Mar 7, 2011 at 10:20 AM
Edited Mar 7, 2011 at 10:26 AM

I have a StackPanel vertical which have a TextBlock and then another StackPanel horizontal with 2 TextBlocks.
The second textblock on the horizontal StackPanel is set to wrap but it doesn't. Here's the entire code along with a screenshot that shows what it does. How would you modify it so the Note Text wraps and make the ToolTip grow vertically to show the Note Text

The problem is in 1024 X 768,  the ToolTip takes all the place in width but not growing in height to show the final text
See this screenshot : http://pages.videotron.com/gear/tooltip.jpg

Here's the C# code.  I know there's just a small adjustment needed but I don't know where to do it.

StackPanel spContent = new StackPanel() { Orientation = System.Windows.Controls.Orientation.Vertical };
StackPanel spNote = new StackPanel() { Orientation = System.Windows.Controls.Orientation.Horizontal };

TextBlock tbHeaderNote = new TextBlock()
{
    FontFamily = new FontFamily("Courier New"),
    FontSize = 14,
    Margin = new Thickness() { Left = 4 },
    Foreground = new SolidColorBrush(Colors.White),
    TextWrapping = System.Windows.TextWrapping.Wrap,
    Text = "Note                   : " 
};

TextBlock tbNote = new TextBlock()
{
    FontFamily = new FontFamily("Courier New"),
    FontSize = 14,
    Margin = new Thickness() { Left = 4 },
    Foreground = new SolidColorBrush(Colors.White),
    TextWrapping = System.Windows.TextWrapping.Wrap, // It's set to Wrap but it doesn't !!!
    Text = ncs.U_Note + Environment.NewLine + Environment.NewLine + Environment.NewLine,
};

spNote.Children.Add(tbHeaderNote);
spNote.Children.Add(tbNote);

TextBlock tbInfo = new TextBlock()
{
    FontFamily = new FontFamily("Courier New"),
    FontSize = 14,
    Margin = new Thickness() { Left = 4 },
    Foreground = new SolidColorBrush(Colors.White),
    Text = "Interface Control Name : " + ncs.Name + Environment.NewLine +
           "Silverlight Property   : " + SLProperty + Environment.NewLine +
           "Step                   : " + ncs.U_ApprovalStepId.ToString() + Environment.NewLine +
           "SAP Form               : " + SAPForm + Environment.NewLine +
           "SQL Table Field        : " + SQLTableField + Environment.NewLine +
           "SDK Property           : " + ncs.U_SAPProperty,
    TextWrapping = TextWrapping.NoWrap,
};

spContent.Children.Add(tbInfo);
spContent.Children.Add(spNote);

tt.Content = spContent;

Silverlight.Controls.ToolTips.ToolTipService.SetToolTip(fe, tt);

 Here's the ToolTip Template :

        <ControlTemplate x:Key="ToolTipTemplate" TargetType="ToolTip">
            <Border BorderBrush="#FFFFF500" BorderThickness="4" CornerRadius="8" Background="#F62F2F2F">
            	<Border.Effect>
            		<DropShadowEffect ShadowDepth="11" Opacity="0.665"/>
            	</Border.Effect>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="auto"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Grid Margin="2" HorizontalAlignment="Left" VerticalAlignment="Top">
                    	<Grid.Effect>
                    		<DropShadowEffect/>
                    	</Grid.Effect>
                        <Ellipse Fill="Black" Height="52" Width="52"/>
                        <Ellipse Stroke="White" StrokeThickness="4" Fill="Blue" Height="50" Width="50"/>
                        <TextBlock Text="i" FontStyle="italic" FontSize="40" FontFamily="Georgia" 
                                               VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White"/>

                    </Grid>
                    <ContentPresenter Grid.Column="1"
										Content="{TemplateBinding Content}"
                                        ContentTemplate="{TemplateBinding ContentTemplate}"
										Margin="{TemplateBinding Padding}"
                                        VerticalAlignment="Top">
                    	<ContentPresenter.Effect>
                    		<DropShadowEffect/>
                    	</ContentPresenter.Effect>
                    </ContentPresenter>
                </Grid>
            </Border>
        </ControlTemplate>