private void DrawRest(DurationCFugue duration, bool dot, byte partIndex) { Image image = new Image(); image.HorizontalAlignment = HorizontalAlignment.Left; image.Source = LayoutController.GetRest(duration, dot); image.Height = LayoutController.ElementHeight["R" + duration]; double top = LayoutController.GetRestTopMargin(image.Height, duration, partIndex); image.Margin = new Thickness(leftMargin, top, 0, 0); staffGrid.Children.Add(image); Grid.SetRow(image, partIndex); }