public void AddNewWaveForm(Color newColor, int samplerate, int bitspersample, int channels) { WaveFormDisplay = new WaveForm(); //WaveFormDisplay.WaveDisplayShape = new Polygon(); WaveFormDisplay.Values = new Dictionary<int, Tuple<float, float>>(); WaveFormDisplay.Stroke = this.Foreground; WaveFormDisplay.StrokeThickness = 1; WaveFormDisplay.Fill = new SolidColorBrush(newColor); WaveFormDisplay.SampleRate = samplerate; WaveFormDisplay.BitsPerSample = bitspersample; WaveFormDisplay.Channels = channels; Canvas.SetZIndex(WaveFormDisplay.WaveDisplayShape, 5); mainCanvas.Children.Add(WaveFormDisplay.WaveDisplayShape); }