Repository navigation
Closed
Labels
area/code-generationCategorizes an issue or PR as relevant to code generationkind/bugSomething isn't workingproject/styling 👔Categorizes an issue or PR as relevant to element styling
Description
Current behavior
this code is fine:
<UserControl.Resources>
<LinearGradientBrush x:Key="TurnedOnLightGradiantColor" StartPoint="0,0.5" EndPoint="1,0.5">
<LinearGradientBrush.GradientStops>
<GradientStop Color="#897de3" Offset="0.5"/>
<GradientStop Color="#764294" Offset="1"/>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
<LinearGradientBrush x:Key="TurnedOffLightGradiantColor" StartPoint="0,0.5" EndPoint="1,0.5">
<LinearGradientBrush.GradientStops>
<GradientStop Color="LightGray" Offset="0.5"/>
<GradientStop Color="DarkGray" Offset="1"/>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</UserControl.Resources>
but if you add a name it will fail
<UserControl.Resources>
<LinearGradientBrush x:Name="TurnedOnLightGradiantColorName" x:Key="TurnedOnLightGradiantColor" StartPoint="0,0.5" EndPoint="1,0.5">
<LinearGradientBrush.GradientStops>
<GradientStop Color="#897de3" Offset="0.5"/>
<GradientStop Color="#764294" Offset="1"/>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
<LinearGradientBrush x:Name="TurnedOffLightGradiantColorName" x:Key="TurnedOffLightGradiantColor" StartPoint="0,0.5" EndPoint="1,0.5">
<LinearGradientBrush.GradientStops>
<GradientStop Color="LightGray" Offset="0.5"/>
<GradientStop Color="DarkGray" Offset="1"/>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</UserControl.Resources>
The name 'nameScope' does not exist in the current context HomeControlApp.Droid \obj\Debug\80\g\XamlCodeGenerator\LightWidgetUC_9e91f51bbe3d28fd457787006913b69b.g.cs

Affected platform(s):
- iOS
- Android
- WebAssembly
- Windows
- Build tasks
Visual Studio
- 2017 (version: )
- 2019 (version: )
- for Mac (version: )
Relevant plugins
- Resharper (version: )
Reacted by Lex Li
Metadata
Metadata
Assignees
Labels
area/code-generationCategorizes an issue or PR as relevant to code generationkind/bugSomething isn't workingproject/styling 👔Categorizes an issue or PR as relevant to element styling
Activity
lextm commentedon May 30, 2020
There is no feasible workaround if controls such as
MenuFlyoutItemare used withx:Load. Example,If we change that to
then Uno XAML code generator works, but UWP will fail with error message,
Therefore, this issue must be fixed
jeromelaban commentedon May 31, 2020
It may be adjusted by #3183.
/cc @davidjohnoliver
davidjohnoliver commentedon Jun 1, 2020
Yes this works correctly with #1766. I'll add a test for it.
test: Add test for named resource in UserControl.Resources
build: Remove explicit `TargetPlatformVersion` (unoplatform#1427)