0
我只是想知道是否可以將屬性應用於業務對象(MyBusinessObject)中的屬性,以便在網格的數據源之後設置爲List(Of MyBusinessObject),該列的可見屬性將自動爲false。例如:將屬性應用於業務對象中的屬性,使得列在數據綁定後不可見
myGrid.DataSource = New List(Of MyBusinessObject)
Public Class MyBusinessObject
'I want these three columns to be visible after data binding
<DisplayName("Property 1")> _
Public Property MyProperty1 As String
<DisplayName("Property 2")> _
Public Property MyProperty2 As Integer
<DisplayName("Property 3")> _
Public Property MyProperty3 As String
'I want this column to have Visible = False after data binding
Public Property MyProperty4 As Integer
End Class
我希望這是有道理的。謝謝!
編輯:我想澄清 - 我仍然喜歡MyProperty4是數據綁定,我只是不希望列可見。
謝謝你的回覆。 Browsable(False)在我的情況下實際上不起作用,因爲它實際上不會將列綁定到網格。我將使用您的第二個建議來製作自定義屬性併發布我的結果。謝謝。 – crunchy 2012-01-03 18:26:05