working with some grid with 4 , 8 or 16 rows and up to 4000 columns like a timeline.
first time messing with WPF. i have most of what i am looking to do doing what it needs to do. getting down to some of the
finals steps and hitting some snags.
i have a grid with two elements with in it , a canvas and
i am using ....
with mouse down i can return the element of the the grid and can use the same code in mouseup and so i know the start of the area select and the end of the area select and able to change all elements with in the selected grid area.
however, when i trigger CaptureMouse, ReleaseMouseCapture to have the area select rectangle visible the mouseup function for reporting grid UIElement no longer the correct element in order to report the grids clicked loction of C, R.
thoughts are that the elements focus is changing and not returning back to the element that needs to report the column and row location of the gird.
first time messing with WPF. i have most of what i am looking to do doing what it needs to do. getting down to some of the
finals steps and hitting some snags.
i have a grid with two elements with in it , a canvas and
i am using ....
<Grid MouseDown="Grid_MouseDown"
MouseUp="Grid_MouseUp"
MouseMove="Grid_MouseMove"
x:Name="MainGridArea" Background="Transparent">
<Canvas>
<Grid
Name="TimeLineGrid" Width="400" Background="LightSteelBlue" ShowGridLines="True">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="45" />
<RowDefinition Height="45" />
<RowDefinition Height="45" />
</Grid.RowDefinitions>
</Grid>
</Canvas>
<Canvas Margin="0,0,0,-94">
<!-- This canvas is overlaid over the previous canvas and is used to
place the rectangle that implements the drag selection box. -->
<Rectangle
x:Name="selectionBox"
Visibility="Collapsed"
Stroke="Black"
StrokeThickness="1"
/>
<TextBox Canvas.Left="6" Canvas.Top="177" Height="279" Name="textBox1" Width="454" />
</Canvas>
</Grid>
with mouse down i can return the element of the the grid and can use the same code in mouseup and so i know the start of the area select and the end of the area select and able to change all elements with in the selected grid area.
var element = (UIElement)e.Source;
c = Grid.GetColumn(element);
r = Grid.GetRow(element);
however, when i trigger CaptureMouse, ReleaseMouseCapture to have the area select rectangle visible the mouseup function for reporting grid UIElement no longer the correct element in order to report the grids clicked loction of C, R.
private void Grid_MouseDown(object sender, MouseButtonEventArgs e)
{
Grid.CaptureMouse();
}
private void Grid_MouseUp(object sender, MouseButtonEventArgs e)
{
Grid.ReleaseMouseCapture();
}
thoughts are that the elements focus is changing and not returning back to the element that needs to report the column and row location of the gird.