eksam/Päevaküsimus/MainWindow.xaml.cs
2017-01-26 17:50:33 +02:00

45 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Päevaküsimus.Models;
namespace Päevaküsimus
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
private MainWindowVM _vm;
public MainWindow()
{
InitializeComponent();
_vm = new MainWindowVM();
this.DataContext = _vm;
}
private void AllQuestionsListBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (this.allQuestionsListBox.SelectedIndex > -1)
{
_vm.selectedQuestion = allQuestionsListBox.SelectedItem as Question;
}
else
{
_vm.selectedQuestion = new Question("Uus küsimus");
}
}
}
}