Vitajte na [www.pocitac.win] Pripojiť k domovskej stránke Obľúbené stránky
 Kliknite na tlačidlo " Štart " vo Windows a vyberte " Microsoft Visual Studio . NET " . 
 2 
 Kliknite na tlačidlo " Otvoriť " a vyberte položku Visual Basic .. NET programu , v ktorom chcete zmeniť podkladovými farbu v GridView forme 
 3 
 Pridajte nasledujúci kód po " verejné Barvapozadí ( ) " riadok v programe : 
 
 Public Class ListViewItemStyleSelector 
 
 Dedí StyleSelector 
 
 Public Overrides Function SelectStyle ( byVal položku As Object , byval kontajner ako DependencyObject ) Vzhľadom k tomu štýlu 
 
 Dim st As New Style ( ) 
 
 st.TargetType = gettype ( ListViewItem ) 
 
 Dim backGroundSetter As New seter ( ) 
 
 backGroundSetter.Property = ListViewItem.BackgroundProperty 
 
 Dim ListView As ListView = TryCast ( ItemsControl.ItemsControlFromItemContainer ( kontajner ) , ListView ) 
 
 Dim index As Integer = listView.ItemContainerGenerator.IndexFromContainer ( kontajnera ) 
 
 ak index Mod 2 = 0 Then 
 
 backGroundSetter.Value = Brushes.LightBlue 
 
 Else 
 
 backGroundSetter.Value = Brushes.Yellow End If 
 
 st.Setters.Add ( backGroundSetter ) 
 
 Späť st 
 
 End Function 
 
 End Class 
 4 
 Kliknite na " Súbor " , " Uložiť " zmeniť farbu pozadia na žltú v GridView .