Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,4 @@ UpgradeLog*.htm

# Microsoft Fakes
FakesAssemblies/
/.vs/EmptyKeys.UserInterface.Generator/v15/Server/sqlite3/db.lock
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added .vs/slnx.sqlite
Binary file not shown.
9 changes: 7 additions & 2 deletions UIGenerator/ResourceDictionaryGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ public class ResourceDictionaryGenerator
/// <param name="classType">Type of the class.</param>
/// <param name="initMethod">The initialize method.</param>
/// <param name="fieldReference">The field reference.</param>
public void Generate(ResourceDictionary dictionary, CodeTypeDeclaration classType, CodeMemberMethod initMethod, CodeExpression fieldReference)
/// <param name="element">The parent element.</param>
public void Generate(ResourceDictionary dictionary, CodeTypeDeclaration classType, CodeMemberMethod initMethod, CodeExpression fieldReference, FrameworkElement element = null)
{
foreach (var mergedDict in dictionary.MergedDictionaries)
{
Expand Down Expand Up @@ -60,7 +61,11 @@ public void Generate(ResourceDictionary dictionary, CodeTypeDeclaration classTyp
initMethod.Statements.Add(new CodeCommentStatement(comment));

CodeExpression keyExpression = CodeComHelper.GetResourceKeyExpression(resourceKey);
CodeExpression valueExpression = valueGenerator.ProcessGenerators(classType, initMethod, resourceValue, "r_" + uniqueId, dictionary);
string basename;
if (element != null) basename = element.Name + "_r";
else basename = "r";

CodeExpression valueExpression = valueGenerator.ProcessGenerators(classType, initMethod, resourceValue, basename + uniqueId, dictionary);

if (valueExpression != null)
{
Expand Down
2 changes: 1 addition & 1 deletion UIGenerator/TypeGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ public CodeExpression ProcessGenerators(object source, CodeTypeDeclaration class
resourcesMethod.Parameters.Add(new CodeParameterDeclarationExpression("UIElement", "elem"));
classType.Members.Add(resourcesMethod);
resourcesGenerator.Generate(elem.Resources, classType, resourcesMethod,
new CodeFieldReferenceExpression(new CodeVariableReferenceExpression("elem"), "Resources"));
new CodeFieldReferenceExpression(new CodeVariableReferenceExpression("elem"), "Resources"), elem);

method.Statements.Add(new CodeMethodInvokeExpression(null,resourcesMethod.Name, parent));
}
Expand Down