Skip to content

Commit 6999402

Browse files
committed
refactor: bind Tasks as ItemSource from the XAML rather than the code behind
1 parent 68f004c commit 6999402

2 files changed

Lines changed: 1 addition & 2 deletions

File tree

Desktop/Project/TasksList.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<Button AutomationProperties.AutomationId="AddTask" Content="_Add task" Command="{Binding Add}" />
1919
</StackPanel>
2020

21-
<ListBox Name="Tasks">
21+
<ListBox ItemsSource="{Binding Tasks}">
2222
<ListBox.ItemTemplate>
2323
<DataTemplate DataType="{x:Type domain:Task}">
2424
<StackPanel Orientation="Horizontal">

Desktop/Project/TasksList.xaml.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ public TasksList(TaskListViewModel viewModel)
1212
DataContext = viewModel;
1313

1414
InitializeComponent();
15-
Tasks.ItemsSource = viewModel.Tasks;
1615

1716
viewModel.PopulateTasks();
1817
viewModel.TaskCreationViewCreator = creationViewModel =>

0 commit comments

Comments
 (0)