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

Composite styles

$
0
0

Hi all!

I need to slightly edit an XAML file to add one little detail; I have a set of shapes, one of them being a simple box, defined as a style. I need to add a textblock to the style if possible to later on add text to the shape from c# code. I guess it is a bit of an overkill to learn WPF and XAML for such a simple task, so if anyone could help, I would be really grateful. 

  <Style x:Key="BOX" TargetType="Path" BasedOn="{StaticResource ShapesItemStyle}">
    <Setter Property="Data" Value="M 0,0 H 60 V40 H 0 Z"/>
  </Style>

  <Style x:Key="BOX_Thumb" TargetType="Path" BasedOn="{StaticResource BOX}">
    <Setter Property="IsHitTestVisible" Value="true"/>
    <Setter Property="Fill" Value="Transparent"/>
    <Setter Property="Stroke" Value="Transparent"/>
  </Style>

<Path Style="{StaticResource BOX}" ToolTip="BOX">
            <s:DesignerItem.ThumbTemplate>
                <ControlTemplate>
                    <Path Style="{StaticResource BOX_Thumb}"/>
                </ControlTemplate>
            </s:DesignerItem.ThumbTemplate>
        </Path>


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>