The DevExpress "Hamburguermenu" control introduces the different menu options using the "MainViewModel.cs" system.
"Configuration.xaml" contains a "Save" button that starts the subform "configuracion_save.xaml" which is where there is a process that must collect the TextBox and ComboBox values from each subform in order to store them in a file.
The problem is, I don't know how to retrieve the TextBox and ComboBox values from each subform in order to save them.
configuracion.xaml
---------------------
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:dxwui="http://schemas.devexpress.com/winfx/2008/xaml/windowsui"
xmlns:dxwuin="http://schemas.devexpress.com/winfx/2008/xaml/windowsui/navigation"
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:local="clr-namespace:Name_MainWindow"
mc:Ignorable="d"
WindowStartupLocation="CenterScreen"
Loaded="Fcn_OnWindowLoaded" Closing="Fcn_WindowClosing" Closed="Window_Closed"
Title="Configuración" dx:ThemeManager.ThemeName="Office2016ColorfulSE" Width="850" Height="500">
BottomBarItemsSource = "{Binding HamburgerMenuBottomBarItems}"
IsMenuVisible = "{Binding IsMenuVisible}"
SelectedItem = "{Binding SelectedItem, Mode=TwoWay}"
NavigationTarget = "{Binding ElementName=service}">
MainViewModel.cs
---------------------
namespace Name_MainWindow
{ public class MainViewModel : DevExpress.Mvvm.NavigationViewModelBase
{ public System.Collections.ObjectModel.ReadOnlyCollection
public System.Collections.ObjectModel.ReadOnlyCollection
public bool IsMenuVisible
{ get{ return GetProperty(() => IsMenuVisible); }
set{ SetProperty(() => IsMenuVisible, value); }
}
public IHamburgerMenuItemViewModel SelectedItem
{ get{ return GetProperty(() => SelectedItem); }
set{ SetProperty(() => SelectedItem, value, OnSelectedItemChanged); }
}
public MainViewModel()
{
HamburgerMenuItems = new System.Collections.ObjectModel.ReadOnlyCollection
HamburgerMenuBottomBarItems = new System.Collections.ObjectModel.ReadOnlyCollection
SelectedItem = HamburgerMenuItems[0];
IsMenuVisible = true;
}
protected virtual System.Collections.Generic.IList
{ string Mensaje = null;
var IHamburgerMenuItem_List = new System.Collections.Generic.List
// --------------------
// HOME.
// --------------------
Mensaje = "Home";
IHamburgerMenuItem_List.Add(new NavigationItemModel(Mensaje){ NavigationTarget = typeof(Name_MainWindow_Configuracion.MainWindow_Configuracion_Inicio), Glyph = "../images/configuracion/configuracion_home.png" });
IHamburgerMenuItem_List.Add(new SeparatorItem());
// --------------------
// GENERAL.
// --------------------
Mensaje = "General";
IHamburgerMenuItem_List.Add(new NavigationItemModel(Mensaje){ NavigationTarget = typeof(Name_MainWindow_Configuracion.MainWindow_Configuracion_General), Glyph = "../images/configuracion/configuracion_general.png" });
IHamburgerMenuItem_List.Add(new SeparatorItem());
// --------------------
// SAVE.
// --------------------
Mensaje = "Save";
IHamburgerMenuItem_List.Add(new NavigationItemModel(Mensaje){ NavigationTarget = typeof(Name_MainWindow_Configuracion.MainWindow_Configuracion_Save), IsAlternatePlacementItem = true, Glyph = "../images/configuracion/configuracion_save.png" });
return IHamburgerMenuItem_List;
}
protected virtual System.Collections.Generic.IList
{
return new System.Collections.Generic.List
{ new BottomBarNavigationItemModel() { NavigationTarget = typeof(Name_MainWindow_Configuracion.MainWindow_Configuracion_Guardar),
Glyph = "../images/configuracion/configuracion_guardar.png", IsAlternatePlacementItem = true },
new BottomBarCheckableItemModel() { Glyph = "check.png" },
new BottomBarRadioItemModel("RadioGroup"){ Glyph = "Icons/Radio1.png" },
new BottomBarRadioItemModel("RadioGroup"){ Glyph = "Icons/Radio2.png" }
};
}
void OnSelectedItemChanged()
{ if (SelectedItem != null)
{ // IsMenuVisible = HamburgerMenuSelectedItem.Caption != "Simple Page";
}
}
}
}
Configuracion_General.xaml
-------------------------------
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
Background="White"
mc:Ignorable="d"
d:DesignWidth="650" d:DesignHeight="450">
Configuracion_save.cs
------------------------
namespace Name_MainWindow_Configuracion
{
public partial class MainWindow_Configuracion_Guardar : System.Windows.Controls.UserControl
{
public MainWindow_Configuracion_Guardar()
{ InitializeComponent();
this.Page_Load();
}
protected void Page_Load()
{ bool Fcn_Correcto = Fcn_AppDatos();
}
private bool Fcn_AppDatos()
{ bool Fcn_Correcto = false;
// AT THIS POINT I have to retrieve the values from each subform so that I can save them to a file.
// For example, in the form "general_configuration.cs" I have to retrieve the TextBox from the "User_TextBox" field.
return Fcn_Correcto;
}
}
}
alex smailPosted Aug 26, 2020, 2:30 PM