Note that there are some explanatory texts on larger screens.

plurals
  1. POCheckBox not showing as a checked in UI
    text
    copied!<p>Hello can any one please help me in my code,</p> <p>i have xaml:</p> <pre><code>&lt;ListView Name="__Listview" ItemsSource="{Binding Path=DisplayItems}"&gt; &lt;CheckBox Content="{Binding Items}" IsChecked="{Binding Path=IsChecked, Mode=TwoWay, NotifyOnTargetUpdated=True}" Checked="CheckBox_Checked" Unchecked="CheckBox_Checked"/&gt; &lt;/ListView&gt; &lt;CheckBox Name="_checkBoxSelectAll" Checked="CheckBoxToCheckAll" Unchecked="CheckBoxToCheckAll"/&gt; </code></pre> <p>Code C#:</p> <pre><code>public partial class DisplayItems { private ObservableCollection&lt;Records&gt; _displayItems = new ObservableCollection&lt; Records&gt;(); public DisplayItems () { InitializeComponent(); _ Listview.DataContext = this; } public ObservableCollection&lt; Records &gt; DisplayItems { get { return _displayItems; } set { _displayItems = value; } } private void CheckBoxToCheckAll(object sender, RoutedEventArgs e) { if (_checking || !(sender is CheckBox)) return; CheckBox checkBox = (CheckBox)sender; _checking = true; foreach (Records swElement in DisplayItems) { bool val; if (checkBox.IsChecked != null) val = checkBox.IsChecked.Value; else val = false; swElement.IsChecked = val; } _checking = false; } private void CheckBox_Checked(object sender, RoutedEventArgs e) { if ((sender as CheckBox) == null || ((sender as CheckBox).DataContext as Records) == null || _checking) return; _checking = true; if (_checkBoxSelectAll.IsChecked != null &amp;&amp; _listTo.All(select =&gt; select.IsChecked) &amp;&amp; !_checkBoxSelectAll.IsChecked.Value) _checkBoxSelectAll.IsChecked = true; else if (_checkBoxSelectAll.IsChecked == null || _checkBoxSelectAll.IsChecked.Value) _checkBoxSelectAll.IsChecked = false; _checking = false; } } Public class Records { public event PropertyChangedEventHandler PropertyChanged; private bool _isChecked = false; Public Records(){} public bool IsChecked { get { return _isChecked; } set { _isChecked = value; OnPropertyChanged("IsChecked"); } } protected void OnPropertyChanged(string name) { if ((PropertyChanged != null) &amp;&amp; (_notification)) PropertyChanged(this, new PropertyChangedEventArgs(name)); } public enum Items{One,Two,three,} } </code></pre> <p>if i Check _checkBoxSelectAll , All checkBoxs in Listview should check, my problem is code behind its IsChecked=true, but in UI not visible that Checkbox is checked, pleae help me in advance</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload