public Control VisitWithResult(XmlNode node, ParseContext context) { var typeName = string.Format("{0}.{1}", node.NamespaceURI, node.LocalName); var childType = context.GetCustomControlType(typeName); if (childType != null) { var control = Activator.CreateInstance(childType) as Control; XamlProcessor.LoadAttributes(control, node, context); // The top-most panel/controls are going to get their DataContexts set to the passed in view model if (control.DataContext == null) { control.DataContext = context.ViewModel; } if (control is Panel) { XamlProcessor.LoadPanel(control as Panel, node, context); } return(control); } Debug.LogError("Could not locate panel class for type: " + typeName); return(null); }
internal Control GenerateItem(object item) { var control = XamlProcessor.LoadDataTemplate(xmlTemplate, context, item); control.DataContext = item; return(control); }
private void SaveXamlElementDefaults(string[] xaml) { try { foreach (var item in xaml) { XamlProcessor.LoadElementDefaults(item); } } catch (Exception e) { Log.Error(e.ToString()); } }
internal void OnConnectedToDesigner() { Bus.Listen <VisualTreeNodeSelected>(OnVisualTreeNodeSelected); Bus.Listen <ForceVisualTreeRefresh>(_ => Designer.GetVisualTree()); Bus.Listen <XamlElementDefaultsReceived>(e => SaveXamlElementDefaults(e.Xaml)); Bus.Listen <OpenXamlResponseReceived>(e => OnOpenXaml(e.Xaml, e.FileName)); Editors.Initialize(); XamlProcessor.Reset(); RegisterPropertyEditors(); SendSupportedTypesMessage(); Designer.GetVisualTree(); Designer.GetDesignSurfaceXaml(); }
public void LoadPage(string view, object viewModel) { Clear(); this.viewModel = viewModel; // Get the controls in one fell swoop so we're not in the process of parsing while updates are going on var parsedControls = XamlProcessor.ParseXaml(view, viewModel); foreach (var c in parsedControls) { controls.Add(c); } }
public void Visit(XmlNode node, ParseContext context) { foreach (var rn in node.ChildNodes.OfType <XmlNode>()) { var itemKey = rn.Attributes.GetNamedItem("Key"); // Not going to support keyless styles and templates for now if (itemKey == null) { Debug.LogWarning("Version 1.0 does not support keyless resources."); continue; } var visitor = XamlProcessor.CreateVisitor(rn); visitor.Visit(rn, context); } }
public Control VisitWithResult(XmlNode node, ParseContext context) { var controlType = context.GetControlType(node.LocalName); if (controlType != null) { var control = Activator.CreateInstance(controlType) as Control; XamlProcessor.LoadAttributes(control, node, context); if (control is Panel) { XamlProcessor.LoadPanel(control as Panel, node, context); } return(control); } Debug.LogError("Could not locate panel class for type: " + node.LocalName); return(null); }
private static void Main(string[] args) { XamlProcessor.Process(); }
private void OnOpenXaml(string[] xaml, string fileName) { XamlProcessor.Reset(); SaveXamlElementDefaults(xaml); Project.State.OpenFile = fileName; }