wpf-devexpress-dot-xpf-dot-charts-dot-chartcontrol-dot-loadfromstream-x28-system-dot-io-dot-stream-x29.md
Deserializing layout settings from untrusted resources may create security issues. Review the following help topic for additional information: Safe Deserialization.
Loads the chart layout from the specified stream.
Namespace : DevExpress.Xpf.Charts
Assembly : DevExpress.Xpf.Charts.v25.2.dll
NuGet Package : DevExpress.Wpf.Charts
public void LoadFromStream(
Stream stream
)
Public Sub LoadFromStream(
stream As Stream
)
| Name | Type | Description |
|---|---|---|
| stream | Stream |
The stream containing the chart to be loaded. An exception is raised if it is empty or null ( Nothing in Visual Basic).
|
Use the LoadFromStream method to load the chart’s layout from the stream to which the layout was saved using the ChartControl.SaveToStream method.
The following code saves the chart layout to a stream, and then loads the layout from the stream:
using System.IO;
//...
Stream stream = new MemoryStream();
// Save the chart.
stream.Seek(0, System.IO.SeekOrigin.Begin);
chartControl1.SaveToStream(stream);
// Load the chart.
stream.Seek(0, System.IO.SeekOrigin.Begin);
chartControl1.LoadFromStream(stream);
Imports System.IO
'...
Dim stream As Stream = New MemoryStream()
' Save the chart.
stream.Seek(0, SeekOrigin.Begin)
chartControl1.SaveToStream(stream)
' Load the chart.
stream.Seek(0, SeekOrigin.Begin)
chartControl1.LoadFromStream(stream)
See Also