Click here to Skip to main content
15,884,099 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: I dont now what is the error "{"An ItemsControl is inconsistent with its items source.\n See the inner exception for more information."}" Pin
Richard Deeming17-Dec-18 9:20
mveRichard Deeming17-Dec-18 9:20 
QuestionI dont now what is the error "{"An ItemsControl is inconsistent with its items source.\n See the inner exception for more information."}" Pin
Rabee3-F1.78754516-Dec-18 1:34
Rabee3-F1.78754516-Dec-18 1:34 
QuestionReorder Elements in ScrollViewer/Grid Pin
GenJerDan12-Dec-18 9:38
GenJerDan12-Dec-18 9:38 
AnswerRe: Reorder Elements in ScrollViewer/Grid Pin
Super Lloyd12-Dec-18 18:11
Super Lloyd12-Dec-18 18:11 
GeneralRe: Reorder Elements in ScrollViewer/Grid Pin
GenJerDan12-Dec-18 19:27
GenJerDan12-Dec-18 19:27 
QuestionBorder With Bound Pulsating Color Pin
Kevin Marois10-Dec-18 5:53
professionalKevin Marois10-Dec-18 5:53 
AnswerRe: Border With Bound Pulsating Color Pin
Super Lloyd12-Dec-18 17:06
Super Lloyd12-Dec-18 17:06 
QuestionBinding To Single List Item Pin
Kevin Marois27-Nov-18 10:23
professionalKevin Marois27-Nov-18 10:23 
I have a list of booleans, and I want to bind checkboxes to this list.\
Code Behind
private List<bool> _OnOffValues;
public List<bool> OnOffValues
{
    get { return _OnOffValues; }
    set
    {
        if (_OnOffValues != value)
        {
            _OnOffValues = value;
            RaisePropertyChanged("OnOffValues");
        }
    }
}
public MyControl()
{
    InitializeComponent();
    this.DataContext = this;
    OnOffValues = new List<bool>();
    for (int x = 0; x < 24; x++)
    {
        OnOffValues.Add(true);
    }
}
XAML
<CheckBox Grid.Row="0"
            Grid.Column="0"
            IsChecked="{Binding OnOffValues[0], ElementName=control}"/>

The output window shows
System.Windows.Data Error: 17 : Cannot get 'Item[]' value (type 'Boolean') from 'OnOffValues' (type 'List`1'). BindingExpression:Path=OnOffValues[0]; DataItem='MyControl' (Name='control'); target element is 'CheckBox' (Name=''); target property is 'IsChecked' (type 'Nullable`1') ArgumentOutOfRangeException:'System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: index'

The code in the contructor runs and the list is populated, but the output message appears BEFORE that.

What am I doing wrong here??
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.

AnswerRe: Binding To Single List Item Pin
Meshack Musundi27-Nov-18 20:17
professionalMeshack Musundi27-Nov-18 20:17 
GeneralRe: Binding To Single List Item Pin
Pete O'Hanlon27-Nov-18 21:03
mvePete O'Hanlon27-Nov-18 21:03 
GeneralRe: Binding To Single List Item Pin
Meshack Musundi27-Nov-18 21:12
professionalMeshack Musundi27-Nov-18 21:12 
GeneralRe: Binding To Single List Item Pin
Pete O'Hanlon27-Nov-18 22:19
mvePete O'Hanlon27-Nov-18 22:19 
GeneralRe: Binding To Single List Item Pin
Meshack Musundi27-Nov-18 21:24
professionalMeshack Musundi27-Nov-18 21:24 
GeneralRe: Binding To Single List Item Pin
Pete O'Hanlon27-Nov-18 22:18
mvePete O'Hanlon27-Nov-18 22:18 
GeneralRe: Binding To Single List Item Pin
Meshack Musundi27-Nov-18 22:45
professionalMeshack Musundi27-Nov-18 22:45 
GeneralRe: Binding To Single List Item Pin
Pete O'Hanlon27-Nov-18 23:11
mvePete O'Hanlon27-Nov-18 23:11 
AnswerRe: Binding To Single List Item Pin
Pete O'Hanlon27-Nov-18 21:01
mvePete O'Hanlon27-Nov-18 21:01 
AnswerRe: Binding To Single List Item Pin
Gerry Schmitz28-Nov-18 19:46
mveGerry Schmitz28-Nov-18 19:46 
Question(solved) Drag and Drop problem Pin
Super Lloyd20-Nov-18 23:36
Super Lloyd20-Nov-18 23:36 
Question(solved) WPF TreeViewItem and Focus Pin
Super Lloyd19-Nov-18 6:45
Super Lloyd19-Nov-18 6:45 
QuestionBest book(s) on WPF Pin
stefano_v15-Nov-18 22:22
stefano_v15-Nov-18 22:22 
AnswerRe: Best book(s) on WPF Pin
Gerry Schmitz20-Nov-18 7:00
mveGerry Schmitz20-Nov-18 7:00 
QuestionWPF - HELP with datepicker Pin
Member 1069141114-Nov-18 3:18
Member 1069141114-Nov-18 3:18 
SuggestionRe: WPF - HELP with datepicker Pin
Richard Deeming14-Nov-18 6:27
mveRichard Deeming14-Nov-18 6:27 
QuestionButton Style Question Pin
Kevin Marois6-Nov-18 4:26
professionalKevin Marois6-Nov-18 4:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.