<Window x:Class="tblr.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<ListBox>
<StackPanel Orientation="Horizontal" Height="28" HorizontalAlignment="Left" VerticalAlignment="Top">
<Label Content="Имя_файла_123" Height="28" HorizontalAlignment="Left" VerticalAlignment="Top" />
<Label Content="Размер Х Мб" Height="28" HorizontalAlignment="Left" VerticalAlignment="Top" />
<ProgressBar IsEnabled="True" IsIndeterminate="True" Height="30" Width="146" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<Label Content="Загрузка" Height="28" HorizontalAlignment="Left" VerticalAlignment="Top" />
<Label Content="Время" Height="28" HorizontalAlignment="Left" VerticalAlignment="Top" />
<Button Content="Play file" Height="28" HorizontalAlignment="Left" VerticalAlignment="Top"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Height="28" HorizontalAlignment="Left" VerticalAlignment="Top">
<Label Content="Имя_файла_123" Height="28" HorizontalAlignment="Left" VerticalAlignment="Top" />
<Label Content="Размер Х Мб" Height="28" HorizontalAlignment="Left" VerticalAlignment="Top" />
<ProgressBar IsEnabled="True" IsIndeterminate="True" Height="30" Width="146" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<Label Content="Загрузка" Height="28" HorizontalAlignment="Left" VerticalAlignment="Top" />
<Label Content="Время" Height="28" HorizontalAlignment="Left" VerticalAlignment="Top" />
<Button Content="Play file" Height="28" HorizontalAlignment="Left" VerticalAlignment="Top"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Height="28" HorizontalAlignment="Left" VerticalAlignment="Top">
<Label Content="Имя_файла_123" Height="28" HorizontalAlignment="Left" VerticalAlignment="Top" />
<Label Content="Размер Х Мб" Height="28" HorizontalAlignment="Left" VerticalAlignment="Top" />
<ProgressBar IsEnabled="True" IsIndeterminate="True" Height="30" Width="146" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<Label Content="Загрузка" Height="28" HorizontalAlignment="Left" VerticalAlignment="Top" />
<Label Content="Время" Height="28" HorizontalAlignment="Left" VerticalAlignment="Top" />
<Button Content="Play file" Height="28" HorizontalAlignment="Left" VerticalAlignment="Top"/>
</StackPanel>
</ListBox>
</Grid>
</Window>
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="WpfApplication1.MainWindow"
Title="MainWindow" Height="350" Width="525">
<Grid>
<ListView ItemsSource="{Binding ExampleList}">
<ListView.Resources>
<DataTemplate x:Key="DataTemplatePBar">
<ProgressBar Value="{Binding PBarValue}" IsIndeterminate="False" Width="100" Height="20"/>
</DataTemplate>
</ListView.Resources>
<ListView.View>
<GridView>
<GridViewColumn Header="Name" DisplayMemberBinding="{Binding Text}"/>
<GridViewColumn Header="ProgressBar" CellTemplate="{DynamicResource DataTemplatePBar}"/>
<GridViewColumn Header="Button">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Button Content="{Binding ButtonText}"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
</Grid>
</Window>
public class MainViewModel
{
public List<ExampleItem> ExampleList { get; set; }
public MainViewModel()
{
this.ExampleList = new List<ExampleItem>();
Populate();
}
public void Populate()
{
for (int i = 1; i <= 5; i++)
{
ExampleList.Add(new ExampleItem { Text = "Example" + i, PBarValue = 10*i,ButtonText = "Button " + i});
}
}
}
public class ExampleItem
{
public string Text { get; set; }
public int PBarValue { get; set; }
public string ButtonText { get; set; }
}
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
MainViewModel main = new MainViewModel();
MainWindow window = new MainWindow
{
DataContext = main
};
window.Show();
}
}