Skip to content

Commit

Permalink
fix(XamlReader): Update invalid collection error message, validate Ta…
Browse files Browse the repository at this point in the history
…bView setter.
  • Loading branch information
jeromelaban committed Oct 26, 2020
1 parent ac86cfb commit cb92cb6
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,17 @@ public void When_StaticResource_SystemTypes()
Assert.AreEqual("Result is 42", r.Resources["myString"]);
}

[TestMethod]
public void When_IList_TabView()
{
var s = GetContent(nameof(When_IList_TabView));
var r = Windows.UI.Xaml.Markup.XamlReader.Load(s) as UserControl;

var tabView1 = r.FindName("tabView1") as Microsoft.UI.Xaml.Controls.TabView;

Assert.AreEqual(2, tabView1.TabItems.Count);
}

private string GetContent(string testName)
{
var assembly = this.GetType().Assembly;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<Page 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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:wux="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
Name="rootPage"
mc:Ignorable="d">

<muxc:TabView x:Name="tabView1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<muxc:TabViewItem Header="Home" IsClosable="False">
<muxc:TabViewItem.IconSource>
<muxc:SymbolIconSource Symbol="Home" />
</muxc:TabViewItem.IconSource>
</muxc:TabViewItem>
<muxc:TabViewItem Header="Document 1">
<muxc:TabViewItem.IconSource>
<muxc:SymbolIconSource Symbol="Document" />
</muxc:TabViewItem.IconSource>
</muxc:TabViewItem>
</muxc:TabView>

</Page>
2 changes: 1 addition & 1 deletion src/Uno.UI/UI/Xaml/Markup/Reader/XamlObjectBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ private void ProcessMemberElements(object instance, XamlMemberDefinition member,
}
else
{
throw new InvalidOperationException("Invalid collection");
throw new InvalidOperationException($"Unsupported collection type {propertyInfo.PropertyType} on {propertyInfo}");
}
}
else
Expand Down

0 comments on commit cb92cb6

Please sign in to comment.