Skip to content

Commit

Permalink
Fix TreeViewNode content display (microsoft#1357)
Browse files Browse the repository at this point in the history
* fix TreeViewNode Tostring

* CR feedback
  • Loading branch information
kaiguo authored Sep 24, 2019
1 parent fb8dd3e commit 75ea41e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
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

0 comments on commit 75ea41e

Please sign in to comment.