Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

How to pass the text for the tooltip using parameters from my XAML?

$
0
0

hi ya,

I need to define the text for one customized tooltip object in my WPF 4.5 app.

My view:

<Button Height="30"  Content="Click Me" Margin="593,41,-295,89" Grid.Column="1" RenderTransformOrigin="-1.66,-4.067"><Button.ToolTip><ToolTip Style="{StaticResource toolTipStyle}"/></Button.ToolTip></Button>

My style allocated in Styles.xaml resources file:

<Style x:Key="toolTipStyle" TargetType="{x:Type ToolTip}"><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="ToolTip"><StackPanel  Height="200" Width="250"><StackPanel Background="#FF99B4D1" Height="30" Width="250" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Top" ><Image VerticalAlignment="Top"  Width="30" Height="30" Source="/Imagenes/Git.jpg" Margin="4" Name="image1" /><TextBlock FontFamily="Trebuchet MS" FontSize="24" FontWeight="Bold" Foreground="Black" 
                                       TextWrapping="Wrap" VerticalAlignment="Top" Height="30"
                                       HorizontalAlignment="Right" Width="143"><Run FontFamily="Trebuchet MS  " FontSize="16" FontWeight="Normal" Text="Reparation Orders"/></TextBlock></StackPanel><StackPanel Width="250" Height="198" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Top" ><Border Name="Border"     Background="CadetBlue"  BorderBrush="White"
                                 BorderThickness="0"    Width="{TemplateBinding Width}"      Height="{TemplateBinding Height}"><ContentPresenter   Margin="1"        HorizontalAlignment="Left"
            VerticalAlignment="Top"><ContentPresenter.Content><TextBlock TextWrapping="Wrap" Foreground="#FF99B4D1" TextAlignment="Center" Background="{x:Null}"
                                       HorizontalAlignment="Right" VerticalAlignment="Top" Width="250" Height="198"><Run  FontFamily="Trebuchet MS" FontSize="12" FontWeight="Normal" Foreground="White" 
                 Text="This option manages all the lifecyle for any Reparation Order"/></TextBlock></ContentPresenter.Content></ContentPresenter></Border></StackPanel></StackPanel></ControlTemplate></Setter.Value></Setter></Style>

Obvioulsy I would need to have the text for every tooltip in every view in my App not in my Styles.xaml file but in every view (customers.xaml, suppliers.xam and so on)

This part must be called from every view:

 <Run  FontFamily="Trebuchet MS" FontSize="12" FontWeight="Normal" Foreground="White"
                 Text="This option manages all the lifecyle for any Reparation Order"/>


Primary platform is Windows 7 Ultimate 64 bit along with VS 2012/Sql2k8 for WPF and SilverLight stuff


Viewing all articles
Browse latest Browse all 18858

Trending Articles