Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TreeViewNode content display #1357

Merged
merged 2 commits into from
Sep 24, 2019
Merged
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
2 changes: 2 additions & 0 deletions dev/TreeView/TreeViewNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ hstring TreeViewNode::GetContentAsString()
{
return result.ToString();
}

return winrt::unbox_value_or<hstring>(content, Type().Name);
}

return Type().Name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,12 @@ public void CornerRadiusTest()
var textBlock = new TextBlock(FindElement.ByName("CheckBoxRectangleCornerRadiusValueTextBlock"));
Verify.AreEqual("2,2", textBlock.DocumentText);
}

[TestMethod]
public void TreeViewNodeContentTest()
{
var node = FindElement.ByName("TreeViewNode1");
Verify.IsNotNull(node, "Verify TreeViewNode conteins right content");
}
}
}
10 changes: 8 additions & 2 deletions test/MUXControlsReleaseTest/NugetPackageTestAppCX/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock x:Name="TestTextBlock" AutomationProperties.Name="TestTextBlock" Text="Loaded"/>
Expand All @@ -54,8 +55,13 @@
<Button x:Name="GetCheckBoxRectangleCornerRadiusValue" Content="GetCheckBoxRectangleCornerRadiusValue" AutomationProperties.Name="GetCheckBoxRectangleCornerRadiusValue" Click="GetCheckBoxRectangleCornerRadiusValue_Click"/>
<TextBlock x:Name="CheckBoxRectangleCornerRadiusValueTextBlock" AutomationProperties.Name="CheckBoxRectangleCornerRadiusValueTextBlock"></TextBlock>
</StackPanel>
<Button Grid.Row="2" Click="OnAddItemsButtonClick" Content="Add Items" AutomationProperties.Name="AddItemsButton" />
<ScrollViewer Grid.Row="3">
<controls:TreeView Grid.Row="2">
<controls:TreeView.RootNodes>
<controls:TreeViewNode Content="TreeViewNode1"/>
</controls:TreeView.RootNodes>
</controls:TreeView>
<Button Grid.Row="3" Click="OnAddItemsButtonClick" Content="Add Items" AutomationProperties.Name="AddItemsButton" />
<ScrollViewer Grid.Row="4">
<controls:ItemsRepeater x:Name="Repeater" />
</ScrollViewer>
</Grid>
Expand Down