1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
6 * Moonlight List (moonlight-list@lists.ximian.com)
8 * Copyright 2008 Novell, Inc. (http://www.novell.com)
10 * See the LICENSE file included with the distribution for details.
17 #include "namescope.h"
19 FrameworkTemplate::FrameworkTemplate ()
21 SetObjectType (Type::FRAMEWORKTEMPLATE
);
27 FrameworkTemplate::~FrameworkTemplate ()
38 FrameworkTemplate::SetXamlBuffer (XamlContext
*xaml_context
, const char *xaml_buffer
)
40 // printf ("%p setting xaml buffer to %s\n", this, xaml_buffer);
41 this->xaml_buffer
= g_strdup (xaml_buffer
);
42 this->xaml_context
= xaml_context
;
46 FrameworkTemplate::GetVisualTree (FrameworkElement
*templateBindingSource
)
49 XamlLoader
*loader
= new XamlLoader (GetResourceBase(), NULL
, xaml_buffer
, GetSurface(), xaml_context
);
52 loader
->SetExpandingTemplate (true);
53 loader
->SetImportDefaultXmlns (true);
55 xaml_context
->SetTemplateBindingSource (templateBindingSource
);
57 DependencyObject
*result
= loader
->CreateDependencyObjectFromString (xaml_buffer
, true, &dummy
);
62 NameScope::GetNameScope (result
)->Lock ();
69 ControlTemplate::ControlTemplate ()
71 SetObjectType (Type::CONTROLTEMPLATE
);
74 DataTemplate::DataTemplate ()
76 SetObjectType (Type::DATATEMPLATE
);
80 DataTemplate::GetVisualTree (FrameworkElement
*templateBindingSource
)
82 // DataTemplate ignores the source paramater and always uses null
83 return FrameworkTemplate::GetVisualTree (NULL
);