我上有一个ListView绑定数据UWP应用程序的工作没有任何数据。我一直在试图找到一种方法来在没有数据时折叠(隐藏)控件。例如,我做的我做一下简单的版本:如何崩溃的UWP数据绑定控件时,有在现场
<ListView Name="lvwMaster" ItemsSource="{x:Bind CollectionOfPeople}">
<ListView.ItemTemplate>
<DataTemplate x:DataType="data:Person">
<StackPanel Name="pnlOnePerson" Margin="10">
<TextBlock Name="lblFirstName" Text="{x:Bind FirstName}" />
<TextBlock Name="lblMiddleName" Text="{x:Bind MiddleName}" Height="Auto" />
<TextBlock Name="lblLastName" Text="{x:Bind LastName}" />
<TextBlock Name="lblBirthDate" Text="{x:Bind BirthDate}" />
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
因为不是每个人都有一个中间的名字,我想中间名称字段被隐藏时,它是空的。
如何我也许能隐藏中间名外地当人没有中间的名字有什么建议?
您应该使用[转换器](https://msdn.microsoft.com/library/windows/apps/windows.ui。 xaml.data.binding.converter)。 – tao