Answer the question
In order to leave comments, you need to log in
How to get checkboxa value from Listboxa template?
Hello,
there is a base
class MeasureVariation
{
public int Id { get; set; }
public string VariationName { get; set; }
public bool IsCalc { get; set; }
public MeasureType MeasureType { get; set; }
}
<ListBox x:Name="lb" Height="290" ItemsSource="{Binding LineVariationList}" Margin="0, 0, 0, 10">
<ListBox.ItemTemplate>
<DataTemplate>
<WrapPanel>
<CheckBox
IsChecked="{Binding Path=IsCalc, Mode=TwoWay}" Content="{Binding Path=VariationName}" Command="{Binding CmdIsCalcChecked, Mode=TwoWay}"/>
</WrapPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
public ObservableCollection<MeasureVariation> LineVariationList { get; set; }
Answer the question
In order to leave comments, you need to log in
Issue resolved. Thanks to all.
I did this, I added a button in the view and when I click on it, a command is executed in which I go through the list and change states. I didn’t manage to do it through triggers, there is room to grow.
foreach (var Item in LineVariationList)
{
var CurrentMeasureVariation = context.MeasureVariations.FirstOrDefault(item => item.Id == Item.Id);
CurrentMeasureVariation.IsCalc = Item.IsCalc;
context.Entry(CurrentMeasureVariation).State = EntityState.Modified;
context.SaveChanges();
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question