I've been learning WPF in college this semester but there are still some things I do not fully understand. I have the following code:
<UserControl x:Class="Reversi.SquareControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="48" d:DesignWidth="48">
<Button Command="{Binding Place}" CommandParameter="{Binding ????????}">
...
</Button>
and:
public partial class SquareControl : UserControl
{
public SquareControl(int x, int y)
{
InitializeComponent();
Coordinates = new Vector2D(x, y);
}
public Vector2D Coordinates
{
get { return (Vector2D) GetValue(CoordinateProperty); }
set { SetValue(CoordinateProperty, value); }
}
...
public static readonly DependencyProperty CoordinateProperty =
DependencyProperty.Register("Coordinates", typeof(Vector2D), typeof(SquareControl), new PropertyMetadata(new Vector2D(0, 0)));
}
My question is: what do I put in the CommandParameter
binding to pass Coordinates
to an ICommand in my ViewModel?