M
M
Michael2016-12-06 21:24:12
WPF
Michael, 2016-12-06 21:24:12

WPF, How to generate a spreadsheet like Excel?

Good afternoon!
I'm just getting started with WPF. There was a task to create an editable plate in which the columns are dates, and the rows are People. In the cells, the user must enter how many hours the person worked that day.
Accordingly, the question is how to generate such a table?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sumor, 2016-12-06
@Sumor

It could be something like this. You start a class with a main object, something like this:

public class Worker
{
public string FIO {get;set;}
public SpanTime WorkTime {get;set;}
}

To display a list of workers, use a ListBox with a template of two textboxes:
<ListBox x:Name="lst">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBox Text="{Binding FIO}" />
<TextBox Text="{Binding WorkTime}" Grid.Column="1"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>

And fill in with your details:
But it is better to find some tabular control and work with it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question