Skip to content

Commit

Permalink
Don't turn all static resources dynamic
Browse files Browse the repository at this point in the history
Make sure users explicitly enable this feature, because otherwise it produces too many false positives and breaks things.

Fixes #9
Also see #24
  • Loading branch information
Kira-NT committed Feb 16, 2025
1 parent c9cda65 commit 8cf866b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion samples/HotReloadDemo/Views/AddItemView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
Command="{Binding OkCommand}">
Ok
</Button>
<TextBox x:Name="DescriptionTextBox" AcceptsReturn="true" Text="{Binding Description}" Watermark="{StaticResource AddItemWatermark}"/>
<TextBox x:Name="DescriptionTextBox" AcceptsReturn="true" Text="{Binding Description}" Watermark="{'StaticResource' AddItemWatermark}"/>
</DockPanel>

</UserControl>
6 changes: 3 additions & 3 deletions src/HotAvalonia/Helpers/AvaloniaControlHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,10 @@ private static void Attach(object? control, ILogical? logicalParent, AvaloniaObj
/// <returns>The XAML markup with static resources replaced by their dynamic counterparts.</returns>
private static string MakeStaticComponentsDynamic(string xaml)
{
const string staticResourceName = "\"{StaticResource ";
const string dynamicResourceName = "\"{DynamicResource ";
const string StaticResourceName = "\"{'StaticResource' ";
const string DynamicResourceName = "\"{'DynamicResource' ";

return xaml.Replace(staticResourceName, dynamicResourceName);
return xaml.Replace(StaticResourceName, DynamicResourceName);
}
}

Expand Down

0 comments on commit 8cf866b

Please sign in to comment.