Disable ListBox Items

2 posts, 0 answers
  1. Oliver
    Oliver avatar
    33 posts
    Member since:
    Jan 2011

    Posted 30 Apr 2012 Link to this post

    I've got a listBox initialised with the following:
    
    lbxFunction.ItemsSource = Enum.GetValues(typeof(ChartAggregateFunction));
    
    How do I disable certain ListBox items?
    
    I tried:
    
    ((RadListBoxItem)lbxFunction.Items[0]).IsEnabled = false;
    
    I get an error.
    
    Any solutions will be appreciated.
    
  2. Oliver
    Oliver avatar
    33 posts
    Member since:
    Jan 2011

    Posted 01 May 2012 Link to this post

    Solved it.
    
    It should be:
    
    ((RadListBoxItem)lbxFunction.ItemContainerGenerator.ContainerFromItem(lbxFunction.Items[0])).IsEnabled = false
    
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top