Ejemplo n.º 1
0
 public Window1()
 {
     InitializeComponent();
     bookLink.Click          += bookLink_Click;
     Closed                  += Window1_Closed;
     themes.SelectionChanged += themes_SelectionChanged;
     DataContext              = new List <TemplatedElementInfo>(TemplatedElementInfo.GetTemplatedElements(presentationFrameworkAssembly));
     themes.SelectedIndex     = 0;
 }
Ejemplo n.º 2
0
        void ElementHolder_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            ContentControl       elementHolder = (ContentControl)sender;
            TemplatedElementInfo elementInfo   = (TemplatedElementInfo)elementHolder.DataContext;

            // Get element (cached)
            object element = GetElement(elementInfo.ElementType);

            // Create and show the element (some have to be shown to give up their templates...)
            ShowElement(elementHolder, element);

            // Fill the element (don't seem to need to do this, but makes it easier to see on the screen...)
            FillElement(element);
        }