Back to Devexpress

ChartControl.LoadFromStream(Stream) Method

wpf-devexpress-dot-xpf-dot-charts-dot-chartcontrol-dot-loadfromstream-x28-system-dot-io-dot-stream-x29.md

latest2.6 KB
Original Source

ChartControl.LoadFromStream(Stream) Method

SECURITY-RELATED CONSIDERATIONS

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

Declaration

csharp
public void LoadFromStream(
    Stream stream
)
vb
Public Sub LoadFromStream(
    stream As Stream
)

Parameters

NameTypeDescription
streamStream

The stream containing the chart to be loaded. An exception is raised if it is empty or null ( Nothing in Visual Basic).

|

Remarks

Use the LoadFromStream method to load the chart’s layout from the stream to which the layout was saved using the ChartControl.SaveToStream method.

Example

The following code saves the chart layout to a stream, and then loads the layout from the stream:

csharp
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);
vb
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

LoadFromFile(String)

SaveToStream(Stream)

ChartControl Class

ChartControl Members

DevExpress.Xpf.Charts Namespace