private void Loaded(object sender, RoutedEventArgs e)
        {
            TreeViewItem tvi = GetAncestorTreeViewItem(AssociatedObject);

            if (tvi != null && tvi.DataContext is TypeNameValue tnv)
            {
                ItemContentTable ict = ItemContentManager.Select(tnv.Value);
                SetItemContentTable(tvi, ict);

                ItemContentTable parentIct = null;
                TreeViewItem     parentTvi = GetAncestorTreeViewItem(tvi);
                if (parentTvi != null)
                {
                    parentIct = GetItemContentTable(parentTvi);
                }
                if (parentIct == null)
                {
                    parentIct = ItemContentManager.Select(null);
                }

                TextBlock   tb = AssociatedObject.FindName("TextBlock") as TextBlock;
                ItemContent ic = parentIct.Select(tnv.Name);
                tb.Text       = ic.Text(tnv);
                tb.Foreground = ic.Error(tnv) ? Brushes.Red : Brushes.Black;
            }
        }
예제 #2
0
 public void Add(string name, ItemContent itemContent)
 {
     Dictionary.Add(name, itemContent);
 }