As I am new with XAML and WPF my question might be ambigious. Accept my appologies in advance.
To make it simple, I am working on a project in which I have some buttons and a custom pointer to select one of these buttons. I could get the program working without using grid rows and columns to organize my elements. However when I was maximizing the window it was a mess. So, I used grid rows and columns with persentage width and height and solved this problem. But now, the pointer gets stucked in one of the grids and does not move outside. I want to define my pointer somehow that it can move along the whole grid without getting binded to a row or column. Here is my XAML code:
<Window x:Class="testGallery.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local ="clr-namespace:Kinect.Toolbox;assembly=Kinect.Toolbox"
Loaded="Window_Loaded"
Title="MainWindow">
<Grid Margin="0,0,0,97">
<Grid.RowDefinitions>
<RowDefinition Height="68*" />
<RowDefinition Height="101*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="150*" />
<ColumnDefinition Width="150*" />
</Grid.ColumnDefinitions>
<Button Click="Button_Click_1" Grid.Column="1" Grid.Row="1" Margin="10" >
<StackPanel>
<Image x:Name="myImage" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="5"/>
</StackPanel>
</Button>
<Canvas x:Name="mouseCanvas" Margin="-24,263,24,-263"/>
</Grid>
</Window>
In the code above the Convas is my custom pointer.
Try
That will allow your canvas to use all your available row and columns. Because you have two of each, setting the Spans to “2” means the whole grid.