如何将行添加到网格

时间:2019-04-29 13:22:23

标签: c# wpf

我在添加诗歌时遇到了问题,我在照片中加了红色。 如何更改代码以获得这种效果?

enter image description here

<Grid x:Name="tableDateFromTo">
    <DatePicker x:Name="dateFrom" SelectedDateFormat="Short" SelectedDateChanged="DatePicker_DataFrom" HorizontalAlignment="Left" Margin="180,57,0,0" VerticalAlignment="Top" Height="28" FontSize="14" Width="100"/>
    <DatePicker x:Name="dateTo"   SelectedDateFormat="Short" SelectedDateChanged="DatePiker_DataTo"    HorizontalAlignment="Left" Margin="311,57,0,0" VerticalAlignment="Top" Height="28" FontSize="14" Width="100"/>
    <Label x:Name="label"       Content="Wybierz zakres dat: Od" HorizontalAlignment="Left" Margin="10,56,0,0"   VerticalAlignment="Top" FontSize="16"/>
    <Label x:Name="labelDateTo" Content="Do"                     HorizontalAlignment="Left" Margin="280,56,0,482" FontSize="16"/>
    <Button x:Name="checkDateFromTo" Content="Wybierz" HorizontalAlignment="Left" Margin="416,57,0,0" VerticalAlignment="Top" FontSize="16" Height="28" Width="75" Click="CheckDateFromTo_Click"/>
    <DataGrid x:Name="dataOfCleanRooms" 
              CanUserSortColumns="False" Margin="0,157,-0.4,0.4"
              AutoGenerateColumns="False"
              CanUserResizeRows="False"
              CanUserResizeColumns="False"
              IsReadOnly="True">
        <DataGrid.Columns>
            <DataGridTextColumn Header="Data" Binding="{Binding ID}"></DataGridTextColumn>

            <DataGridTextColumn Header="Piętra 1-2" Binding="{Binding ServiceDays1to2}"></DataGridTextColumn>
            <DataGridTextColumn Header="Serwis duży"></DataGridTextColumn>
            <DataGridTextColumn Header="Serwis mały"></DataGridTextColumn>

            <DataGridTextColumn Header="Piętra 3-5" Binding="{Binding ServiceDays3to5}"></DataGridTextColumn>
            <DataGridTextColumn Header="Serwis duży"></DataGridTextColumn>
            <DataGridTextColumn Header="Serwis mały"></DataGridTextColumn>

            <DataGridTextColumn Header="Piętra 6-8" Binding="{Binding ServiceDays6to8}"></DataGridTextColumn>
        </DataGrid.Columns>
    </DataGrid>
</Grid>

0 个答案:

没有答案