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

How to create ControlTemplate with Path in C# codes?

$
0
0

I am studying and extending the famous WPF Diagram Designer (Part 4) from codeproject.

Here is a snippet :

<!-- Document --><Style x:Key="Document" TargetType="Path" BasedOn="{StaticResource FlowChartItemStyle}"><Setter Property="Data" Value="M 0,0 H 60 V 40 C 30,30 30,50 0,40 Z"/></Style><Style x:Key="Document_DragThumb" TargetType="Path" BasedOn="{StaticResource Document}"><Setter Property="IsHitTestVisible" Value="true"/><Setter Property="Fill" Value="Transparent"/><Setter Property="Stroke" Value="Transparent"/></Style><!--
 ...
--><s:DesignerItem.DragThumbTemplate><ControlTemplate><Path Style="{StaticResource Document_DragThumb}"/></ControlTemplate></s:DesignerItem.DragThumbTemplate>

It created a ControlTemplate for the DesignerItem from a Path.

How can I create a ControlTemplate from a Path in C# codes?


Viewing all articles
Browse latest Browse all 18858

Trending Articles



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