Note that there are some explanatory texts on larger screens.

plurals
  1. POSetting title on a styled control
    primarykey
    data
    text
    <p>I have created a WPF popup style and using it in many places in the application. The popup title is defined in the style and I'm not sure how to change it to different values throuhout the application, this is the style:</p> <pre><code>&lt;Style x:Key="PopupContentStyle1" TargetType="ContentControl"&gt; &lt;Setter Property="Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType="ContentControl"&gt; &lt;Grid Height="90" Width="392" Background="Transparent"&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="20"/&gt; &lt;RowDefinition/&gt; &lt;/Grid.RowDefinitions&gt; &lt;Grid Grid.Row="1"&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="0.092*"&gt;&lt;/ColumnDefinition&gt; &lt;ColumnDefinition Width="0.007*"/&gt; &lt;ColumnDefinition Width="0.054*"/&gt; &lt;ColumnDefinition Width="0.115*"/&gt; &lt;ColumnDefinition Width="0.732*"/&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;Border CornerRadius="10" Grid.ColumnSpan="5"&gt; &lt;Border.Background&gt; &lt;LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"&gt; &lt;GradientStop Color="#FF333C3C" Offset="0" /&gt; &lt;GradientStop Color="#FF464646" Offset="0.25" /&gt; &lt;GradientStop Color="#FF504E50" Offset="0.75" /&gt; &lt;GradientStop Color="#FF595D59" Offset="1" /&gt; &lt;/LinearGradientBrush&gt; &lt;/Border.Background&gt; &lt;Border Background="{DynamicResource TemplateBackgroundColour}" Margin="5,15,5,5" CornerRadius="5" BorderThickness="0,1,0,0"&gt; &lt;ContentPresenter /&gt; &lt;/Border&gt; &lt;/Border&gt; &lt;Label Name="popupTitle" Content="Sample title" Grid.Column="0" HorizontalAlignment="Center" Height="Auto" Margin="0" VerticalAlignment="Top" Width="Auto" Foreground="{DynamicResource DefaultFontColour}" Padding="0" Grid.ColumnSpan="5" /&gt; &lt;/Grid&gt; &lt;/Grid&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; </code></pre> <p>this is how i call and want to change the title to reflect popup content:</p> <pre><code>&lt;Popup x:Name="p1" AllowsTransparency="True"&gt; &lt;ContentControl Style="{StaticResource PopupContentStyle1}" &gt; &lt;ContentControl.Content&gt; &lt;Grid&gt; &lt;TextBox&gt;Popup user control goes here&lt;/TextBox&gt; &lt;/Grid&gt; &lt;/ContentControl.Content&gt; &lt;/ContentControl&gt; &lt;/Popup&gt; </code></pre> <p>Please help.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload