Hi,
there'sno problem to show PolyLine in real time. Try following MVVM demo:
XAML:
ViewModel:
See attached text.20445-x.txt
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I want draw line represent wave audio and display it in realtime. Aslo for other audio representation as audio spectrum and other audio graphs (osciloscope etc..)
In WPF documentation is only how to draw line, polyline paths etc.. but how to draw it in realtime? If I want change point position in polyline or path, I have to recreate it completly. Isn't it performance loss?
Here is how I draw path (it is not realtime, but it is computed every time as I change a slider and it redraw the line)
void CreateGraph()
{
// ...
CanvasView.Children.Clear();
if (pline != null) // pline = PolyLine
{
pline.Stroke = new SolidColorBrush(Color.FromRgb(60, 125, 200));
pline.StrokeThickness = 1;
pointCollection = new PointCollection();
for (int i = 0; i < max; i++)
{
// ...
pointCollection.Add(new Point(i * sirka, v)); // pointCollection = PointCollection
}
pline.Points = pointCollection;
CanvasView.Children.Add(pline);
}
}
Is it this code good or there is alternative which save performance?
Hi,
there'sno problem to show PolyLine in real time. Try following MVVM demo:
XAML:
ViewModel:
See attached text.20445-x.txt