所以我有這個 wpf 資料網格,其列在 xaml 檔案中定義,我以編程方式檢查資料并在按下按鈕后 1 個 1 插入行。
我試圖了解如何填充它并設定排序(與單擊列標題相同的排序)
在我以前添加的winforms中:
$myDataGrid.Sort($myDataGrid.Columns[3],'Ascending')
在我的填充功能之后。
我如何在 WFP(和 powershell)中復制它?
我確實嘗試過:
$Datagrid.Items.SortDescription.Add([pscustomobject]@{ColumnName="MyColumn";SortDirection="ListSortDirection.Ascending"})
但是我遇到了很多麻煩,因為我只找到 c# 解釋并且嘗試適應并沒有成功....
uj5u.com熱心網友回復:
嘗試這個:
$sortDescription = New-Object System.ComponentModel.SortDescription('MyColumn', 'Ascending')
$Datagrid.Items.SortDescriptions.Add($sortDescription)
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/436187.html
