Powershell表单 - ListView - 填充列

时间:2017-12-11 13:46:19

标签: wpf powershell listview

我设计了一个Powershell Gui工具,该工具的设计非常好,但我仍然坚持如何用几个xml文件中的数据填充listview列。

我有四列我想要填充

# ListView
$LvMain= New-Object System.Windows.Forms.Listview
$LvMain.Location = '300, 55'
$LvMain.Name = "ListViewInfo"
$LvMain.Size = "850, 600"
$LvMain.Text = "Pattern text"
$LvMain.Scrollable = $true 
$LvMain.ContextMenuStrip = $ContextMenu
$LvMain.FullRowSelect = $True
$LvMain.GridLines = $True
$LvMain.UseCompatibleStateImageBehavior = $False
$LvMain.View = "Details"
$LvMain.font ="lucida console"
$LvMain.Controls.Add($ApplicationFormListViewInfo)
# Columns
$LvMain.Columns.Add("FileName")
$LvMain.Columns.Add("Folder")
$LvMain.Columns.Add("Line")
$LvMain.Columns.Add("Path")

这意味着当我按下按钮时#34;跑" 我将使用

从几个xml文件中提取数据
$GetXmlData = Get-ChildItem -Path $Path -Recurse -force -Include $FileTypes | Select-String -Pattern $Pattern 

使用$Patterns Filename,Foldername,Line ( which line the pattern is ) and Path ( UncPath ).

填充列

如何找到关于listview如何工作的真正好的教程很难找到。

任何知道如何以正确的方式引导我的人?

1 个答案:

答案 0 :(得分:0)

您可以查看以下链接,查看一个工作清单样本。

sort-a-windows-forms-listview-in-powershell-without-a-custom-comparer