DataBoxView.xaml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <Window x:Class="Awesomeness.GUI.Views.DataBoxView"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  5. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  6. xmlns:local="clr-namespace:Awesomeness.GUI"
  7. xmlns:viewmodels="clr-namespace:Awesomeness.GUI.ViewModels"
  8. d:DataContext="{d:DesignInstance Type=viewmodels:DataBoxViewModel}"
  9. mc:Ignorable="d"
  10. Title="DataBoxView" Height="450" Width="800">
  11. <Grid>
  12. <Grid.RowDefinitions>
  13. <RowDefinition Height="auto" />
  14. <RowDefinition Height="20" />
  15. <RowDefinition Height="*" />
  16. </Grid.RowDefinitions>
  17. <Menu Grid.Row="0">
  18. <MenuItem Header="_File">
  19. <MenuItem Header="E_xit" Command="{x:Static ApplicationCommands.Close}" />
  20. <MenuItem Header="New User" Command="{Binding AddUserCommand}" />
  21. </MenuItem>
  22. </Menu>
  23. <TextBlock Grid.Row="1" Text="{Binding AFantasticString}" />
  24. <DataGrid Grid.Row="2" ItemsSource="{Binding Users}"
  25. AutoGenerateColumns="False"
  26. SelectionMode="Extended"
  27. SelectionUnit="CellOrRowHeader"
  28. AlternationCount="2"
  29. AlternatingRowBackground="Beige"
  30. RowBackground="Aquamarine"
  31. CanUserAddRows="False"
  32. CanUserReorderColumns="False">
  33. <DataGrid.Columns>
  34. <DataGridTextColumn Binding="{Binding Id, Mode=OneWay}" Header="Id" Width="auto" IsReadOnly="True" />
  35. <DataGridTextColumn Binding="{Binding Name}" Header="Min första kolumn" Width="auto" />
  36. <DataGridTextColumn Binding="{Binding Age}" Header="Min andra kolumn" Width="auto" />
  37. <DataGridCheckBoxColumn Binding="{Binding IsAdmin}" Header="Admin" Width="auto" />
  38. <DataGridTemplateColumn Header="Actions" Width="*">
  39. <DataGridTemplateColumn.CellTemplate>
  40. <DataTemplate>
  41. <StackPanel Orientation="Horizontal" Background="Red">
  42. <Button Content="Delete" Command="{Binding DataContext.RemoveUserCommand, RelativeSource={RelativeSource AncestorType=DataGrid}}"
  43. CommandParameter="{Binding}"
  44. Margin="10,0" />
  45. </StackPanel>
  46. </DataTemplate>
  47. </DataGridTemplateColumn.CellTemplate>
  48. </DataGridTemplateColumn>
  49. </DataGrid.Columns>
  50. </DataGrid>
  51. </Grid>
  52. </Window>