lundi 3 mars 2014

Binding DTO in WPF


Vote count:

0




I got my Listbox binding to my BindableCollection but I want to only display the Filename. Currently it's displaying the "DTO"



public class FilesDTO : IDTO
{
public int Id { get; set; }
public string FileName { get; set; }
public string FileExtension { get; set; }
public byte[] FileArray { get; set; }
}

using (var ctx = DB.Get())
{
Files = new BindableCollection<FilesDTO>(ctx.Files.Select(x => new FilesDTO { FileArray = x. FileArray, FileExtension = x.FileExtension, FileName = x.FileName, Id = x.Id }));
}


Xaml side:



<ListBox x:Name="Attachments" Grid.Row="2" ItemsSource="{Binding Files}" />


I tried {Binding Files.Filename} doesn't work either. My guess is creating properties to bind to :S



asked 40 secs ago






Aucun commentaire:

Enregistrer un commentaire