G
Giulio Petrucci
Hello there,
starting from this minimal XAML
<Window x:Class="Acme.Graph.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Border BorderBrush="Black" BorderThickness="2"></Border>
<Rectangle Grid.Column="0" Height="40" Width="40"
Fill="Black"></Rectangle>
<Canvas AllowDrop="True"></Canvas>
</Grid>
</Window>
the main window has:
- on the left side: a black square
- on right side: a canvas
I need to implement this behaviour: dragging the black square onto the
canvas, when the black square is dropped, a imilar square is drawn on
the canvas.
How would you approach the problem in a WPF-style? Triggers? Commands?
Or a lot of code-behind, like in WinForms?
Thanks in advance.
Ciao,
Giulio
--
starting from this minimal XAML
<Window x:Class="Acme.Graph.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Border BorderBrush="Black" BorderThickness="2"></Border>
<Rectangle Grid.Column="0" Height="40" Width="40"
Fill="Black"></Rectangle>
<Canvas AllowDrop="True"></Canvas>
</Grid>
</Window>
the main window has:
- on the left side: a black square
- on right side: a canvas
I need to implement this behaviour: dragging the black square onto the
canvas, when the black square is dropped, a imilar square is drawn on
the canvas.
How would you approach the problem in a WPF-style? Triggers? Commands?
Or a lot of code-behind, like in WinForms?
Thanks in advance.
Ciao,
Giulio
--