daily pastebin goal
87%
SHARE
TWEET

Untitled

a guest Aug 21st, 2018 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Use vb to add item and change value of second column of listview in wpf
  2. <ListView Grid.Column="1" Height="auto" Name="ListView1" Width="auto" AllowDrop ="True" >
  3.         <ListView.View>
  4.             <GridView >
  5.                 <GridViewColumn Header="File Name" />
  6.                 <GridViewColumn Header="Path" />
  7.                 <GridViewColumn Header="type" />
  8.             </GridView>
  9.         </ListView.View>
  10.     </ListView>
  11.    
  12. ListView1.Items.Add("abcd")
  13.    
  14. Dim x As ItemCollection
  15.     x.Add("a")
  16.     x.Add("b")
  17.     x.Add("c")
  18.     ListView1.Items.Add(x)
  19.  
  20.     Dim x As New ItemCollection
  21.     x.Add("a")
  22.     x.Add("b")
  23.     x.Add("c")
  24.     ListView1.Items.Add(x)
  25.    
  26. ListView1.Items(0)(1)
  27.    
  28. Public Class ListViewItemTemplate
  29.     Public Property FileName As String
  30.     Public Property FilePath As String
  31.     Public Property FileType As String
  32. End Class
  33.    
  34. <ListView Name="ListView1" Width="auto" AllowDrop ="True" Margin="0,0,0,41">
  35.         <ListView.View>
  36.             <GridView >
  37.                 <GridViewColumn Header="File Name" DisplayMemberBinding="{Binding Path=FileName}" />
  38.                 <GridViewColumn Header="Path" DisplayMemberBinding="{Binding Path=FilePath}"/>
  39.                 <GridViewColumn Header="type" DisplayMemberBinding="{Binding Path=FileType}" />
  40.             </GridView>
  41.         </ListView.View>
  42.     </ListView>
  43.    
  44. Dim itemsList As New List(Of ListViewItemTemplate)
  45.     Dim item As New ListViewItemTemplate
  46.     item.FileName = "FileName A"
  47.     item.FilePath = "FilePath A"
  48.     item.FileType = "FileType A"
  49.     itemsList.Add(item)
  50.     item = New ListViewItemTemplate
  51.     item.FileName = "FileName B"
  52.     item.FilePath = "FilePath B"
  53.     item.FileType = "FileType B"
  54.     itemsList.Add(item)
  55.     item = New ListViewItemTemplate
  56.     item.FileName = "FileName C"
  57.     item.FilePath = "FilePath C"
  58.     item.FileType = "FileType C"
  59.     itemsList.Add(item)
  60.     ListView1.ItemsSource = itemsList
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top