private void saveConfig_clicked(object sender, RoutedEventArgs e) { DeviceTreeViewModel dtvm = (DeviceTreeViewModel)deviceTree.DataContext; string xmlConfig = XMLHelper <List <DeviceTreeModel> > .objectToXml(dtvm.ListDeviceTreeModel); XMLHelper <List <DeviceTreeModel> > .saveFile("config.xml", xmlConfig); }
public DeviceTreeView() { InitializeComponent(); // call dummy mouse down to disable the context menus tree_MouseDown(null, null); DeviceTreeViewModel dtvm = new DeviceTreeViewModel(); dtvm.init(this); DataContext = dtvm; contextMenu.init(this); }