Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code> &lt;ListView Name="list" Grid.Row="1" ItemsSource={Binding Path=Files} &gt; &lt;ListView.View&gt; &lt;GridView&gt; &lt;GridViewColumn Header="Name"&gt; &lt;GridViewColumn.CellTemplate&gt; &lt;DataTemplate&gt; &lt;Button&gt; &lt;TextBlock Text="{BindingPath=Name}"/&gt; &lt;/Button&gt; &lt;/DataTemplate&gt; &lt;/GridViewColumn.CellTemplate&gt; &lt;/GridViewColumn&gt; &lt;GridViewColumn Header="Size"&gt; &lt;GridViewColumn.CellTemplate&gt; &lt;DataTemplate&gt; &lt;Button&gt; &lt;TextBlock Text="{BindingPath=Size}"/&gt; &lt;/Button&gt; &lt;/DataTemplate&gt; &lt;/GridViewColumn.CellTemplate&gt; &lt;/GridViewColumn&gt; &lt;GridViewColumn Header="Path"&gt; &lt;GridViewColumn.CellTemplate&gt; &lt;DataTemplate&gt; &lt;Button&gt; &lt;TextBlock Text="{BindingPath=Path}"/&gt; &lt;/Button&gt; &lt;/DataTemplate&gt; &lt;/GridViewColumn.CellTemplate&gt; &lt;/GridViewColumn&gt; &lt;/GridView&gt; &lt;/ListView.View&gt; &lt;/ListView&gt; </code></pre> <h1>My your ViewModel will be</h1> <pre><code>public class FileListViewModel : INotifyPropertyChanged { /// &lt;summary&gt; /// /// &lt;/summary&gt; public ObservableCollection&lt;Fileinfo&gt; Files{ get; set; } private Fileinfo selectedFile; public Fileinfo SelectedFile { get { return selectedFile; } set { selectedFile= value; InvokePropertyChanged(new PropertyChangedEventArgs("SelectedFile")); } } public PersonListViewModel() { //Loading List Files= new ObservableCollection&lt;Fileinfo&gt;() { //This is temp list you modify accordinh to you logic new FileInfo{Name = "File32"}, new FileInfo{Name = "File33"}, new FileInfo{Name = "File373"}, new FileInfo{Name = "File393"}, new FileInfo{Name = "File345"}, new FileInfo{Name = "File375"}, new FileInfo{Name = "File395"}, new FileInfo{Name = "File387"}, new FileInfo{Name = "File387"} }; } #region Implementation of INotifyPropertyChanged /// &lt;summary&gt; /// /// &lt;/summary&gt; public event PropertyChangedEventHandler PropertyChanged; /// &lt;summary&gt; /// /// &lt;/summary&gt; /// &lt;param name="e"&gt;&lt;/param&gt; public void InvokePropertyChanged(PropertyChangedEventArgs e) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) handler(this, e); } #endregion } </code></pre> <h1>Your Model should be like</h1> <pre><code>public class FileinFo: INotifyPropertyChanged { private string size; public event PropertyChangedEventHandler PropertyChanged; private string name; private bool isSelected; public string Size { get { return size; } set { size= value; InvokePropertyChanged(new PropertyChangedEventArgs("size")); } } public string Name { get { return name; } set { name = value; InvokePropertyChanged(new PropertyChangedEventArgs("Name")); } } public bool IsSelected { get { return isSelected; } set { isSelected = value; InvokePropertyChanged(new PropertyChangedEventArgs("IsSelected")); } } public void InvokePropertyChanged(PropertyChangedEventArgs e) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) handler(this, e); } } </code></pre> <p>You need to set the datacontext of yor View to ViewModel </p> <p>so lets say your view is named as FileListView.xaml</p> <p>Then in code behind in the Constructor you can write </p> <pre><code>this.DataContext= new FileListViewModel(); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload