|
10 | 10 | </UserControl.Resources> |
11 | 11 | <Grid> |
12 | 12 | <StackPanel> |
13 | | - <StackPanel Orientation="Horizontal"> |
14 | | - <Label Content="Tasks:" /> |
15 | | - <Button AutomationProperties.AutomationId="AddTask" Content="+" FontSize="20" Command="{Binding Add}" /> |
16 | | - </StackPanel> |
| 13 | + <Grid> |
| 14 | + <Grid.ColumnDefinitions> |
| 15 | + <ColumnDefinition Width="*" /> |
| 16 | + <ColumnDefinition Width="Auto" /> |
| 17 | + </Grid.ColumnDefinitions> |
| 18 | + |
| 19 | + <Label Grid.Column="0" Content="Tasks:" HorizontalAlignment="Left" VerticalAlignment="Center" /> |
| 20 | + <Button Grid.Column="1" AutomationProperties.AutomationId="AddTask" HorizontalAlignment="Right" |
| 21 | + VerticalAlignment="Center" |
| 22 | + Content="+" FontSize="20" |
| 23 | + Command="{Binding Add}" /> |
| 24 | + </Grid> |
17 | 25 |
|
18 | 26 | <ListBox ItemsSource="{Binding Tasks}" Margin="{StaticResource SmallMarginAtTop}"> |
| 27 | + <ListBox.ItemContainerStyle> |
| 28 | + <Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}"> |
| 29 | + <Setter Property="HorizontalContentAlignment" Value="Stretch" /> |
| 30 | + </Style> |
| 31 | + </ListBox.ItemContainerStyle> |
| 32 | + |
19 | 33 | <ListBox.ItemTemplate> |
20 | 34 | <DataTemplate DataType="{x:Type domain:Task}"> |
21 | | - <StackPanel Orientation="Horizontal"> |
22 | | - <TextBlock Text="{Binding Name}" /> |
23 | | - <Button Content="Delete" |
| 35 | + <Grid HorizontalAlignment="Stretch"> |
| 36 | + <Grid.ColumnDefinitions> |
| 37 | + <ColumnDefinition Width="*" /> |
| 38 | + <ColumnDefinition Width="Auto" /> |
| 39 | + </Grid.ColumnDefinitions> |
| 40 | + |
| 41 | + <TextBlock Grid.Column="0" Text="{Binding Name}" HorizontalAlignment="Left" |
| 42 | + VerticalAlignment="Center" /> |
| 43 | + <Button Grid.Column="1" Content="Delete" HorizontalAlignment="Right" |
| 44 | + VerticalAlignment="Center" |
24 | 45 | Command="{Binding DataContext.Delete, ElementName=Root}" |
25 | 46 | CommandParameter="{Binding}" /> |
26 | | - </StackPanel> |
| 47 | + </Grid> |
27 | 48 | </DataTemplate> |
28 | 49 | </ListBox.ItemTemplate> |
29 | 50 | </ListBox> |
|
0 commit comments