Browse Source

reproduce missing `x:Static` in decompiled BAML

pull/2536/head
bert2 5 years ago committed by wwh1004
parent
commit
59bababa9f
  1. 6
      ILSpy.BamlDecompiler.Tests/BamlTestRunner.cs
  2. 9
      ILSpy.BamlDecompiler.Tests/Cases/Issue2116.xaml
  3. 16
      ILSpy.BamlDecompiler.Tests/Cases/Issue2116.xaml.cs
  4. 4
      ILSpy.BamlDecompiler.Tests/ILSpy.BamlDecompiler.Tests.csproj

6
ILSpy.BamlDecompiler.Tests/BamlTestRunner.cs

@ -148,6 +148,12 @@ namespace ILSpy.BamlDecompiler.Tests @@ -148,6 +148,12 @@ namespace ILSpy.BamlDecompiler.Tests
RunTest("cases/issue2097");
}
[Test]
public void Issue2116()
{
RunTest("cases/issue2116");
}
#region RunTest
void RunTest(string name)
{

9
ILSpy.BamlDecompiler.Tests/Cases/Issue2116.xaml

@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
<UserControl x:Class="ILSpy.BamlDecompiler.Tests.Cases.Issue2116" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:ILSpy.BamlDecompiler.Tests.Cases" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006">
<FrameworkElement.Resources>
<ResourceDictionary>
<Style x:Key="TestStyle1" />
<Style x:Key="TestStyle2" BasedOn="{StaticResource {x:Static local:Issue2116.StyleKey1}}" />
</ResourceDictionary>
</FrameworkElement.Resources>
<Grid Style="{StaticResource {x:Static local:Issue2116.StyleKey1}}" />
</UserControl>

16
ILSpy.BamlDecompiler.Tests/Cases/Issue2116.xaml.cs

@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
namespace ILSpy.BamlDecompiler.Tests.Cases
{
using System.Windows;
using System.Windows.Controls;
public partial class Issue2116 : UserControl
{
public static ComponentResourceKey StyleKey1 => new ComponentResourceKey(typeof(Issue2116), "TestStyle1");
public static ComponentResourceKey StyleKey2 => new ComponentResourceKey(typeof(Issue2116), "TestStyle2");
public Issue2116()
{
InitializeComponent();
}
}
}

4
ILSpy.BamlDecompiler.Tests/ILSpy.BamlDecompiler.Tests.csproj

@ -59,6 +59,7 @@ @@ -59,6 +59,7 @@
<Compile Include="Cases\CustomControl.cs" />
<Compile Include="Cases\Issue1547.xaml.cs" />
<Compile Include="Cases\Issue2097.xaml.cs" />
<Compile Include="Cases\Issue2116.xaml.cs" />
<Compile Include="Cases\MyControl.xaml.cs">
<DependentUpon>MyControl.xaml</DependentUpon>
</Compile>
@ -99,6 +100,9 @@ @@ -99,6 +100,9 @@
<Page Include="Cases\Issue2097.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Cases\Issue2116.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Cases\Issue775.xaml">
<SubType>Designer</SubType>
</Page>

Loading…
Cancel
Save