/// <summary> /// Resizes the SkeletonCanvas /// </summary> /// <param name="canvas"></param> private void SizeSkeletonCanvas(SkeletonCanvas canvas) { canvas.RenderTransform = new ScaleTransform(1.0, -1.0, gridSnapshot.ColumnDefinitions[0].ActualWidth / 2.0, gridSnapshot.RowDefinitions[0].ActualHeight / 2.0); }
/// <summary> /// Adds a new Gesture Segment Canvas to the DataGrid /// </summary> private void AddSkeletonCanvas() { // We only support a maximum of 10 segments per gesture if (GestureSegmentCount > 9) { _activeSkeletonCanvas = null; return; } // Create a new Canvas to add to the grid SkeletonCanvas temp = new SkeletonCanvas() { Background = new SolidColorBrush(Color.FromRgb(0, 0, 0)) }; // Put the canvas in the correct grid position Grid.SetColumn(temp, (GestureSegmentCount < 5) ? GestureSegmentCount : GestureSegmentCount - 5); Grid.SetRow(temp, GestureSegmentCount / 5); // Do the transformation necessary to draw the skeleton SizeSkeletonCanvas(temp); // Add the canvas to the grid gridSnapshot.Children.Add(temp); // Set the active canvas segment _activeSkeletonCanvas = temp; // Increase the number of segments in the gesture GestureSegmentCount++; }