public void SetViewmodel(ComponentAbilityTemplateVM vm) { DataContext = vm; _vm = vm; TypesComBox.DataContext = vm.ItemDictTypes; vm.ItemDictTypes.SelectionChangedEvent += ItemDictTypes_SelectionChangedEvent; vm.ItemDict.CollectionChanged += ItemDict_CollectionChanged; }
public ComponentTemplateAbilityPropertiesView(ComponentAbilityTemplateVM viewModel) : this() { _viewModel = viewModel; DataContext = viewModel; _viewModel.SelectedGuiHint.PropertyChanged += GuiHint_SelectedIndexChanged; GuiHint_SelectedIndexChanged(this, null); ButtonMenuItem btnAdd = new ButtonMenuItem(); btnAdd.Command = _viewModel.AddToEditCommand; btnAdd.Text = "Add To Edit Field"; ButtonMenuItem btnDel = new ButtonMenuItem(); btnDel.Text = "Delete This Ability Item"; btnDel.Command = _viewModel.DeleteCommand; ContextMenuButtons.Add(btnAdd); ContextMenuButtons.Add(btnDel); ContextMenuItem = new ContextMenu(ContextMenuButtons); }