Window1.xaml
<Canvas x:Name="mycanvas">
<Button Width="100" Height="50" Canvas.Left="350" Canvas.Top="50" Click="Button_Click">Click to Display</Button>
<ContentControl Width="130"
Height="130"
Canvas.Top="150"
Canvas.Left="470" Name="cc1"
Template="{StaticResource DesignerItemTemplate}">
<Grid x:Name="g1">
<Ellipse Fill="LightGray" Stroke="Black" Stretch="Fill" Name="myElli" IsHitTestVisible="False"/>
<TextBlock VerticalAlignment="Center" TextAlignment="Center" Height="61.96" Margin="10,35.02,10,33.02">Simple Ellipse</TextBlock>
</Grid>
</ContentControl>
<ContentControl Width="130"
Height="130"
Canvas.Top="150"
Canvas.Left="150"
Template="{StaticResource DesignerItemTemplate}">
<Grid>
<Path Fill="LightGray" Stroke="Black" Name="myPath"
Data="M 0,5 5,0 10,5 5,10 Z"
Stretch="Fill"
IsHitTestVisible="False"/>
<TextBlock VerticalAlignment="Center" TextAlignment="Center">Simple Path</TextBlock>
</Grid>
</ContentControl>
</Canvas>
Hello,
I'm quite a newbie in WPF. I started programming on WPF a few days ago.
I'm working on creation of certian shapes on WPF.
I have created two shapes. I want to create copies of these shapes and place them on the same canvas. I would like to do this by capturing event of the Button.
It would also be convinient if the newly created shapes have different text inside them instead of the default text which I have currently placed.
Is there a way to do this? How should I handle this using C# code? Am I on the right track in creation of this shapes? Any better way to do this would be very helpful.
Thanks in advance!