Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Oops, not there)
<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();
}
}
I think it's more convenient to make each line of the list from several elements and output it as a list of lines. Or at once to do the table with elements. WinForms and WPF will have different implementations, so it's worth deciding from the very beginning. Every technology has its pitfalls
Could you be more specific, I didn't understand either the first sentence or the second one?
Windows Forms - desktop applications - very limited functionality, considered "deprecated" because does not support window scaling on different resolutions, e.g.
Windows Presentation Framework - xml-based gui, extensible, convenient, with more advanced functionality.
You are actually invited to read about the differences between them.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question