TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Emanuele Doria
NA
100
3.6k
wpf how i write on db from checkbox list
Oct 25 2018 12:40 PM
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++)
{
//fill range of checkboxes read from db
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++) ????
{
???????????????????????
}
}
Reply
Answers (
2
)
How to open a new window or user control through command
wpf navigate from page to window