I am playing around with WPF a bit. Here is the Code that does not work how i want it to.
<ListView Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" ItemsSource="{Binding FilesToUpload}">
<ListView.View>
<GridView>
<GridViewColumn Header="Filename" DisplayMemberBinding="{Binding FileName}">
</GridViewColumn>
<GridViewColumn Header="Uploaded" DisplayMemberBinding="{Binding Uploaded}">
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
The ItemsSource of ListView binds to a property of a class that returns a collection of this class.
public class FileInformation
{
public String FileName { get; set; }
public ProgressBar Uploaded { get; set; }
public FileInformation(String file)
{
FileName = file;
Uploaded = new ProgressBar();
Uploaded.Value = 8;
Uploaded.BorderThickness = new System.Windows.Thickness(5);
}
}
The GridView from the xaml example above has two columns. One binds to the property FileName of class FileInformation and the other binds to Uploaded.
The problem is. The property Uploaded returns a ProgressBar but the content of the column that binds to Uploaded is a String (The returnvalue of ToString() Method of the ProgressBar i guess.).
Any suggestions how i can show the ProgressBar instead of a String?
Try This: