This is a migrated thread and some comments may be shown as answers.

Disable ListBox Items

1 Answer 77 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Oliver
Top achievements
Rank 1
Oliver asked on 30 Apr 2012, 09:36 AM
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.

1 Answer, 1 is accepted

Sort by
0
Oliver
Top achievements
Rank 1
answered on 02 May 2012, 04:29 AM
Solved it.

It should be:

((RadListBoxItem)lbxFunction.ItemContainerGenerator.ContainerFromItem(lbxFunction.Items[0])).IsEnabled = false
Tags
ListBox
Asked by
Oliver
Top achievements
Rank 1
Answers by
Oliver
Top achievements
Rank 1
Share this question
or