Ejemplo n.º 1
0
        private void CanSaveCustomToTemplate(object sender, CanExecuteRoutedEventArgs e)
        {
            TreeView   treeView       = (TreeView)e.Parameter;
            NoteOption noteOption     = (NoteOption)treeView.SelectedItem;
            NoteOption templateOption = noteOption?.RootIdea?.RootSaveFile?.Template?.CharacterTemplate?.Traits;

            if (treeView == null || noteOption == null || templateOption == null)
            {
                e.CanExecute = false;
            }
            else if (templateOption.FindOption(noteOption.Path) == null)
            {
                e.CanExecute = true;
            }
            else
            {
                e.CanExecute = false;
            }
        }
Ejemplo n.º 2
0
        /// <inheritdoc/>
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            if (values.Length < 2)
            {
                return(Brushes.LightPink);                   // problem
            }
            NoteOption option         = values[0] as NoteOption;
            NoteOption templateOption = values[1] as NoteOption;

            if (option == null || templateOption == null)
            {
                return(Brushes.LightPink);                                          // problem
            }
            else if (templateOption.FindOption(option.Path) == null)
            {
                return(Brushes.SteelBlue);                                                     // not in template
            }
            else
            {
                return(Brushes.Transparent); // in template
            }
        }