In order to show an object on a toolbox and allow user to drag/drop it on canvas I am using following control:
<HeaderedItemsControl x:Key="itemABC"
Width="100"
Height="100"
Canvas.Left="210"
Canvas.Top="220"
Margin="0,0,0,0"
Style="{StaticResource ABC_Style}">
</HeaderedItemsControl>
and
In style have defined:
<Style x:Key="ABC_Style" TargetType="HeaderedItemsControl">
<Setter Property="Data" Value="M10.395,0.5 L30.237,0.5 30.237,5.0359993 39.499999,5.0359993 39.499999,22.75 30.237,22.75 30.237,42.660999 39.499999,42.660999 39.499999,60.375 30.237,60.375 30.237,65 10.395,65 10.395,58.124999 0.5,58.124999 0.5,10 10.395,10 z"/>
</Style>
However, the problem is that HeaderdItemsControl has no Path attribute (as far as I know) so I’m wondering what other option I can have here.
In fact, I need to show a path inside a HeaderedItemsControl in XAML.
Thanks.
This example works:
The default style for
HeaderedItemsControldoesn’t normally actually include the header, for reasons beyond me. Also the way you were trying to set the header to be the path data you had wasn’t right, so I fixed it by defining thePathGeometryas a static resource and then including aPathusing that as theHeader.