hello
i have application wpf where i create 30 checkboxes and check a range with condition read from database:
- <DataTemplate x:Key="DataTemplate_Level2">
- <CheckBox IsChecked="{Binding Mode=OneWay}" Checked="CheckBox_Checked" Height="30" Width="30" Margin="4,4,4,4"/>
- </DataTemplate>
-
- <DataTemplate x:Key="DataTemplate_Level1">
- <ItemsControl ItemsSource="{Binding}" ItemTemplate="{DynamicResource DataTemplate_Level2}">
- <ItemsControl.ItemsPanel>
- <ItemsPanelTemplate>
- <StackPanel Orientation="Horizontal"/>
- </ItemsPanelTemplate>
- </ItemsControl.ItemsPanel>
- </ItemsControl>
- </DataTemplate>
-
- </UserControl.Resources>
-
-
- <Grid>
- <StackPanel Orientation="Horizontal">
- <ItemsControl x:Name="lst" ItemTemplate="{DynamicResource DataTemplate_Level1}" />
- <Button Click="Button_Click" Content="salva"/>
- </StackPanel>
- </Grid>
codebehind:
- DB_Crew1Entities entita = new DB_Crew1Entities();
- List<OperazioniBettolina> row;
- List<List<bool>> lsts;
-
- public UC_Orari()
- {
- row= entita.OperazioniBettolinas.ToList();
-
- lsts = new List<List<bool>>();
-
- for (int i = 0; i < row.Count(); i++)
- {
- lsts.Add(new List<bool>());
-
- for (int j = 0; j < 30; j++)
- {
-
- lsts[i].Add(row[i].StratTime<= j && j < riga[i].EntTime);
-
- }
- }
-
- InitializeComponent();
-
- lst.ItemsSource = lsts;
-
- }
How can i write on db?
if the user check other checkbox i should save another(new) range ::
- private void Button_Click(object sender, RoutedEventArgs e)
- {
- for (int i = 0; i < lsts.Count(); i++) ????
- {
- ???????????????????????
-
- }
- }