dimanche 18 avril 2021

Multiple checkboxes in wpf

I have multiple checkboxes and I want the checked checkboxes to be loaded in another window in a datagrid. I'm having trouble with the multiple checkboxes and how can I add the checked boxes in to a datagrid. I'm a fresher and really new to programming. I have to use wpf and c# for this.

please check my code.

enter code here   

enterXaml enter code here

        <DataGrid x:Name="DatagridWell" Margin="20,20,20,221" >
            <DataGrid.Columns>

                <DataGridTextColumn Header="Well" Width="*" />
                <DataGridTextColumn Header="TimeLog" Width="*"/>
                <DataGridTextColumn Header="DepthLog"  Width="*"/>
                <DataGridTextColumn Header="MudLog"  Width="*"/>
                <DataGridTextColumn Header="Trajectory"  Width="*"/>
            </DataGrid.Columns>
        </DataGrid>
        <StackPanel Orientation="Vertical" Width="110" Height="189" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="35,50,0,0">
            <CheckBox Content="Well 1"  Margin="10,10,10,10"/>
            <CheckBox Content="Well 2"  Margin="10,10,10,10"/>
            <CheckBox Content="Well 3"  Margin="10,10,10,10"/>
            <CheckBox Content="Well 4"  Margin="10,10,10,10"/>
            <CheckBox Content="Well 5"  Margin="10,10,10,10"/>
        </StackPanel>

        <StackPanel Orientation="Vertical" Width="115" Height="189" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="165,50,0,0">
            <CheckBox Content="2hrs"  Margin="10,10,10,10"/>
            <CheckBox Content="4hrs"  Margin="10,10,10,10"/>
            <CheckBox Content="6hrs"  Margin="10,10,10,10"/>
            <CheckBox Content="8hrs"  Margin="10,10,10,10"/>
            <CheckBox Content="10hrs"  Margin="10,10,10,10"/>
        </StackPanel>

        <StackPanel Orientation="Vertical" Width="125" Height="189" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="290,50,0,0">
            <CheckBox Content="10ft"  Margin="10,10,10,10" />
            <CheckBox Content="20ft" Margin="10,10,10,10"/>
            <CheckBox Content="30ft"  Margin="10,10,10,10"/>
            <CheckBox Content="40ft"  Margin="10,10,10,10"/>
            <CheckBox Content="50ft"  Margin="10,10,10,10"/>
        </StackPanel>

        <StackPanel Orientation="Vertical" Width="115" Height="189" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,50,175,0">
            <CheckBox Content="45.5"  Margin="10,10,10,10"/>
            <CheckBox Content="55.5"  Margin="10,10,10,10"/>
            <CheckBox Content="66.5"  Margin="10,10,10,10"/>
            <CheckBox Content="77.5" Margin="10,10,10,10"/>
            <CheckBox Content="88.5"  Margin="10,10,10,10"/>
        </StackPanel>

        <StackPanel Orientation="Vertical" Width="115" Height="189" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,50,30,0">
            <CheckBox Content="200.6" Margin="10,10,10,10"/>
            <CheckBox Content="300.5"  Margin="10,10,10,10"/>
            <CheckBox Content="400.5"  Margin="10,10,10,10"/>
            <CheckBox Content="500.6"  Margin="10,10,10,10"/>
            <CheckBox Content="700"  Margin="10,10,10,10"/>
        </StackPanel>


        <Button x:Name= "AddStatus" Content="OK" HorizontalAlignment="Left" Margin="618,0,0,274" VerticalAlignment="Bottom" Width="62" Click="AddStatus_Click" />

    </Grid>
</StackPanel>
enter code here



Aucun commentaire:

Enregistrer un commentaire