New to Telerik UI for WPF? Download free 30-day trial


The FileManager is an extension class which can be used to save/load your RadDiagram in a file on your Disk or in your application's IsolatedStorage.


  • CurrentFile: A property of type string that gets or sets the current file path.


FileManager class exposes two methods: LoadFromFile and SaveToFile. Depending on the parameter of these methods, the XML string can be saved to two storage locations: Disk or IsolatedStorage.

  • LoadFromFile(FileLocation location = FileLocation.Disk): This method accepts an enum of type FileLocation. By default the FileManager will load the XML string from the hard drive.

  • SaveToFile(FileLocation location = FileLocation.Disk): This method accepts an enum of type FileLocation. By default the FileManager will save the XML string to the hard drive.

To demonstrate this extension we are going to create a very simple application. First we can go ahead and declare the RadDiagram in XAML and add some shapes. Then we can add two buttons for save and load behavior.

Example 1: Specify your RadDiagram in XAML

        <RowDefinition Height="*"/> 
        <RowDefinition Height="Auto"/> 
    <telerik:RadDiagram x:Name="diagram"> 
        <telerik:RadDiagramShape x:Name="Shape1" Content="Shape1" Position="200,300"/> 
        <telerik:RadDiagramShape x:Name="Shape2" Content="Shape2" Position="200,100"/> 
        <telerik:RadDiagramConnection Source="{Binding ElementName=Shape1}" Target="{Binding ElementName=Shape2}" /> 
    <Grid Grid.Row="1"> 
        <telerik:RadButton Content="Load" Width="200"  HorizontalAlignment="Left" Click="Load_Click"/> 
        <telerik:RadButton Content="Save"  Width="200" HorizontalAlignment="Right" Click="Save_Click"/> 
Then we can subscribe to the Click event of the Save/Load buttons. The next step is to declare our FileManager and set its CurrentFile property. This property sets the path where the XML file will be saved on the user Disk.

Example 2: Specify FileManager and save/load the RadDiagram

public partial class MainWindow : Window 
    FileManager fileManager; 
    public MainWindow() 
        fileManager = new FileManager(this.diagram); 
        fileManager.CurrentFile = @"C:\Temp"; 
    private void Load_Click(object sender, RoutedEventArgs e) 
    private void Save_Click(object sender, RoutedEventArgs e) 

See Also

In this article