private Dictionary <string, CodePropertyReferenceExpression> CreatePropertiesForResources(IEnumerable <Resource> resources) { return(resources.ToDictionary(resource => resource.Key, resource => { DataTemplateResource dataTemplateResource = resource as DataTemplateResource; Tuple <CodeMemberField, CodeMemberProperty> result; if (dataTemplateResource != null) // in case of data templates { const string type = "Storm.Mvvm.DataTemplate"; result = CodeGeneratorHelper.GenerateProxyProperty(resource.PropertyName, type, fieldReference => new List <CodeStatement> { // _field = new DataTemplate(); new CodeAssignStatement(fieldReference, new CodeObjectCreateExpression(CodeGeneratorHelper.GetTypeReferenceFromName(type))), // _field.ViewId = Resource.Id.*** new CodeAssignStatement(new CodePropertyReferenceExpression(fieldReference, "ViewId"), CodeGeneratorHelper.GetAndroidResourceReference(ResourcePart.Layout, dataTemplateResource.ViewId)), // _field.LayoutInflater = LayoutInflater; new CodeAssignStatement(new CodePropertyReferenceExpression(fieldReference, "LayoutInflater"), GetLayoutInflaterReference()), // _field.ViewHolderType = typeof(viewholder class) new CodeAssignStatement(new CodePropertyReferenceExpression(fieldReference, "ViewHolderType"), new CodeTypeOfExpression(string.Format("{0}.{1}", Configuration.GeneratedNamespace, dataTemplateResource.ViewHolderClassName))), }); } else { // create a proxy property to handle the resource string type = resource.Type; Dictionary <string, string> assignments = resource.Properties; result = CodeGeneratorHelper.GenerateProxyProperty(resource.PropertyName, type, fieldReference => CodeGeneratorHelper.GenerateStatementsCreateAndAssign(fieldReference, type, assignments)); } Fields.Add(result.Item1); Properties.Add(result.Item2); return CodeGeneratorHelper.GetPropertyReference(result.Item2); })); }