Imports System.Xml

Public Class DlgTreeView

  Private Sub btGuardarDocXml_Click(sender As System.Object, e As System.Windows.RoutedEventArgs)
    ' Recuperar el proveedor XML de los recursos de MainWindow
    Dim dataProvider As XmlDataProvider = TryCast(Me.FindResource("xmlAlumnos"), XmlDataProvider)
    Dim nombreFicheroXml As String = "../../Datos/alumnos.xml"
    dataProvider.Document.Save(nombreFicheroXml)
  End Sub

  Private Sub btRecargarDocXml_Click(sender As System.Object, e As System.Windows.RoutedEventArgs)
    Dim dataProvider As XmlDataProvider = TryCast(Me.FindResource("xmlAlumnos"), XmlDataProvider)
    Dim docXml As New XmlDocument()
    Dim nombreFicheroXml As String = "../../Datos/alumnos.xml"
    docXml.Load(nombreFicheroXml)
    ' Asignar el documento modificado, usando la raíz de docXml
    dataProvider.Document = docXml
  End Sub

  Private Sub btExpandirNodos_Click(sender As System.Object, e As System.Windows.RoutedEventArgs)
    trvAlumnos.Style = DirectCast(Me.FindResource("Expandir"), Style)
  End Sub

  Private Sub btContraerNodos_Click(sender As System.Object, e As System.Windows.RoutedEventArgs)
    trvAlumnos.Style = DirectCast(Me.FindResource("Contraer"), Style)
  End Sub
End Class
