33 lines
870 B
C#
33 lines
870 B
C#
using System.ComponentModel;
|
|
using Avalonia.Controls;
|
|
using Avalonia.Controls.Primitives;
|
|
using Avalonia.Controls.Templates;
|
|
using PortfolioManager.ViewModels;
|
|
|
|
namespace PortfolioManager.Views;
|
|
|
|
public partial class MainWindow : Window
|
|
{
|
|
private TabControl tabControl = null;
|
|
|
|
public MainWindow()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void tabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
{
|
|
if (null == tabControl)
|
|
{
|
|
tabControl = (TabControl)sender;
|
|
MainWindowViewModel viewModel = (MainWindowViewModel)DataContext;
|
|
viewModel.OnIndexChangeEventHandler += OnIndexChangeEvent;
|
|
}
|
|
}
|
|
|
|
protected void OnIndexChangeEvent(object sender, TabIndexArgs args)
|
|
{
|
|
if (null == tabControl) return;
|
|
tabControl.SelectedIndex = args.Index;
|
|
}
|
|
} |