Skip to main content
You are viewing help content for a version that is no longer maintained/updated.
All docs
V21.2
  • DataSourceRemovedEventArgs.IsDataSourceInternal Property

    Gets whether the data source is internal (loaded with the document template or added in the UI using the Data Source Wizard) or external (added manually or used in other parts of the application).

    Namespace: DevExpress.Snap

    Assembly: DevExpress.Snap.v21.2.Core.dll

    NuGet Package: DevExpress.Snap.Core

    Declaration

    public bool IsDataSourceInternal { get; }

    Property Value

    Type Description
    Boolean

    true if the data source was loaded with the document template or added in the UI using the Data Source Wizard; otherwise, false.

    Remarks

    The IsDataSourceInternal property indicates whether the data source can be safely removed.

    If the property returns true, the data source can be disposed of using the IDisposable.Dispose method. If false, additional examination is required.

    The example below shows how to use this property to safely dispose of the data source.

    Example

    public Form1()
    {
      InitializeComponent();
      this.snapControl1.Document.DataSources.DataSourceRemoved += OnDataSourceRemoved;
    }     
    
    
    void OnDataSourceRemoved(object sender, DevExpress.Snap.DataSourceRemovedEventArgs e)
    {
      if (e.IsDataSourceInternal)
        {
         IDisposable disposable = e.DataSourceInfo.DataSource as IDisposable;
         if (disposable != null) { disposable.Dispose(); }
        }
     }
    
    See Also