public ItemPage() { InitializeComponent(); // load preview & set item _item = new TrinityItem(); DataContext = _item; Loaded += ItemPage_Loaded; _preview = new ItemPreview(_item); }
private void newItemBtn_Click(object sender, RoutedEventArgs e) { var result = MessageBox.Show("Are you sure you want to discard this item and clear the form?", "Discard item", MessageBoxButton.YesNo, MessageBoxImage.Warning); if (result == MessageBoxResult.Yes) { _item = new TrinityItem(); _preview = new ItemPreview(_item); PreviewBox.Content = _preview; DataContext = null; DataContext = _item; PrepareItemPage(); } }