public void DataTemplateCastDataContextBindingSource(
     DataTemplateCastDataContextBindingSourceNode dataTemplateCastDataContextBindingSourceNode,
     StringBuilder stringBuilder,
     int indent)
 {
     PrivateVisit(stringBuilder, indent, dataTemplateCastDataContextBindingSourceNode, dataTemplateCastDataContextBindingSourceNode.Bindings);
 }
        public bool DataTemplateCastDataContextBindingSource(
            DataTemplateCastDataContextBindingSourceNode dataTemplateCastDataContextBindingSourceNode,
            Parameters parameters,
            Context context)
        {
            if (this.VisitChildBindings(dataTemplateCastDataContextBindingSourceNode.Bindings, parameters, context))
            {
                context.XamlModificationTracker.ModificationsRootElement = dataTemplateCastDataContextBindingSourceNode.ContentElement;
                return(true);
            }

            return(false);
        }
Exemple #3
0
        public bool DataTemplateCastDataContextBindingSource(
            DataTemplateCastDataContextBindingSourceNode dataTemplateCastDataContextBindingSourceNode,
            Parameters parameters,
            Context context)
        {
            var sourceType    = dataTemplateCastDataContextBindingSourceNode.CastType;
            var bindingSource = context.BindingSourceProvider.AddDataContext(sourceType);
            var newContext    = new Context(new StringBuilder(), bindingSource, context);

            if (this.VisitChildBindings(dataTemplateCastDataContextBindingSourceNode.Bindings, parameters, newContext))
            {
                context.ExternAliases.TryAdd(sourceType);
                context.BindingContainerSourceCodeBuilder.AppendLine($"            var {bindingSource.Name} = this.GetDataContext(view => ({sourceType.ToAliasQualifiedType()})view.DataContext);");
                context.BindingContainerSourceCodeBuilder.Append(newContext.BindingContainerSourceCodeBuilder);
                return(true);
            }

            return(false);
        }