bloxstrap/Bloxstrap/UI/Elements/Menu/Pages/InstallationPage.xaml.cs
pizzaboxer 94fe52245e
Refactor UI code structuring
109 changed files :D
2023-07-02 13:10:04 +01:00

38 lines
1.0 KiB
C#

using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input;
using Bloxstrap.UI.ViewModels.Menu;
namespace Bloxstrap.UI.Menu.Pages
{
/// <summary>
/// Interaction logic for InstallationPage.xaml
/// </summary>
public partial class InstallationPage
{
public InstallationPage()
{
DataContext = new InstallationViewModel();
InitializeComponent();
}
// https://stackoverflow.com/a/13289118/11852173
// yes this doesnt fully conform to xaml but whatever
private void TextBox_KeyEnterUpdate(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
TextBox tBox = (TextBox)sender;
DependencyProperty prop = TextBox.TextProperty;
BindingExpression binding = BindingOperations.GetBindingExpression(tBox, prop);
if (binding is not null)
binding.UpdateSource();
}
}
}
}