private void ListBoxItem_PreviewMouseUp(object sender, MouseButtonEventArgs e) { var data = (sender as ListBoxItem).DataContext as SpiritViewModel; var listbox = FindAncestor <ListBox>((sender as ListBoxItem)); SpiritWindow.Show(data, (listbox.DataContext as SpiritListViewModel).List); }
public MainWindow() { InitializeComponent(); SpiritWindow = new SpiritWindow(); Confirmation = new ConfirmationWindow(); CloseButton.Click += (a, e) => Close(); TitleBar.MouseDown += (a, e) => DragMove(); this.Closing += (a, e) => WindowClose(); ListAddButton.Click += (a, e) => MainViewModel.Lists.Add(new SpiritListViewModel() { ListTitle = "new List" }); SettingWindow = new SettingWindow(MainViewModel.Setting); if (Messanger.IsAuth) { SettingWindow.TwitterAuthButton.IsEnabled = false; SettingWindow.TwitterAuthButton.Content = "認証済み"; } this.DataContext = MainViewModel; Grass.TargetWebView = GrassView; Grass.GetGrass(MainViewModel.Setting.GitHubName); SettingButton.Click += (a, e) => SettingWindow.Show(); }
private void AddButton_Click(object sender, RoutedEventArgs e) { var x = (sender as Button).DataContext as SpiritListViewModel; var spirit = new SpiritViewModel() { Title = "new Spirit." }; x.List.Add(spirit); SpiritWindow.Show(spirit, x.List); }
private void WindowClose() { SpiritWindow.Close(); Confirmation.Close(); SettingWindow.Close(); }