• Source
    1. <!--http://www.bravohex.com-->
    2. <Window x:Class="WPF_CRUD_EFCodeFirst_Simple.MainWindow"
    3. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    5. Title="Wpf Example: CRUD EF Code First " Height="350
    6. " Width="600">
    7.  
    8. <Grid>
    9. <!--Chia Form thành 4 hàng-->
    10. <Grid.RowDefinitions>
    11. <RowDefinition Height="Auto"/>
    12. <RowDefinition Height="Auto"/>
    13. <RowDefinition Height="Auto"/>
    14. <RowDefinition Height="*"/>
    15. </Grid.RowDefinitions>
    16. <!--Hàng 1-->
    17. <Label Grid.Row="0" Content="DEMO" FontWeight="Bold" HorizontalAlignment="Center"/>
    18.  
    19. <!--Hàng 2-->
    20. <Grid Grid.Row="1">
    21. <!--Chia thành 2 hàng và 4 cột nhỏ-->
    22. <Grid.RowDefinitions>
    23. <RowDefinition Height="Auto"/>
    24. <RowDefinition Height="Auto"/>
    25. <RowDefinition Height="Auto"/>
    26. </Grid.RowDefinitions>
    27. <Grid.ColumnDefinitions>
    28. <ColumnDefinition Width="Auto"/>
    29. <ColumnDefinition Width="*"/>
    30. <ColumnDefinition Width="Auto"/>
    31. <ColumnDefinition Width="*"/>
    32. </Grid.ColumnDefinitions>
    33. <Label Grid.Row="0" Grid.Column="0" Content="Employee Id:"/>
    34. <Label Grid.Row="1" Grid.Column="0" Content="First Name:"/>
    35. <Label Grid.Row="1" Grid.Column="2" Content="Last Name:"/>
    36. <Label Grid.Row="2" Grid.Column="0" Content="Birthday:"/>
    37. <Label Grid.Row="2" Grid.Column="2" Content="Dep Id:"/>
    38.  
    39. <TextBox Grid.Row="0" Grid.Column="1" IsEnabled="False" Margin="5,5,5,5" FontFamily="Awe"/>
    40. <TextBox Grid.Row="1" Grid.Column="1" Margin="5,5,5,5"/>
    41. <TextBox Grid.Row="1" Grid.Column="3" Margin="5,5,5,5"/>
    42.  
    43. <DatePicker Grid.Row="2" Grid.Column="1" Margin="5,5,5,5"/>
    44. <ComboBox Grid.Row="2" Grid.Column="3" Margin="5,5,5,5"/>
    45. </Grid>
    46.  
    47. <!--Hàng 3-->
    48. <StackPanel Grid.Row="2" Orientation="Horizontal" Margin="0,10,0,10" HorizontalAlignment="Center">
    49. <Button Content="Insert;" Width="70" Height="35" Margin="0,0,40,0" />
    50. <Button Content="Update;" Width="70" Height="35" Margin="0,0,20,0" />
    51. <Button Content="Delete;" Width="70" Height="35" Margin="20,0,0,0" />
    52. <Button Content="Exit;" Width="70" Height="35" Margin="40,0,0,0" />
    53. </StackPanel>
    54.  
    55. <!--Hàng 4-->
    56. <DataGrid Grid.Row="3" Margin="10,0,10,10">
    57.  
    58. </DataGrid>
    59. </Grid>
    60. </Window>
    61.