我正在尝试从我的信息中提取信息,listview
但似乎无法选择特定的dataset
. 从这里提取信息时,我总是能取回全部内容,但永远不能只读取一组。
我将把行数据提取为:
chartViewList2.SelectedItem
我通过向列表视图添加信息
private void getServices(string ComputerName)
{
chartListView2.Items.Clear();
ServiceController[] services = ServiceController.GetServices(ComputerName);
foreach (ServiceController service in services)
{
chartListView2.Items.Add(new { Service = service.ServiceName, Status = service.Status, Desc = service.DisplayName });
}
}
列表视图 XML:
ListView x:Name="chartListView2" Margin="12,59,46,6"
GridViewColumnHeader.Click="GridViewColumnHeaderClickedHandler2">
<ListView.View>
<GridView>
<GridViewColumn Header="Service" DisplayMemberBinding="{Binding Service}" Width="100"/>
<GridViewColumn Header="Status" DisplayMemberBinding="{Binding Status}" Width="60"/>
<GridViewColumn Header="Desc" DisplayMemberBinding="{Binding Desc}" Width="190"/>
</GridView>
</ListView.View>
</ListView>
我想从中得到的只是服务名称字段。
任何帮助将不胜感激!