We're working with VS 2012, .NET 4.5. There will be times when we've got to prevent the user from adding or editing data on the user controls that we're writing. Our user controls will all have one main tab control, with other container controls within each TabItem control (things like dock panels, grids, stack panels, etc.) Like others we've discovered that the TabControl doesn't have a IsReadOnly property. I've searched for ways of preventing users from either adding new data or editing existing data, and have seen suggestions like defining a DependencyProperty for the TabControl which could be assessable from controls on the TabItem controls, but that seems like a lot of XAML coding to accomplish. And I've seen an example where the questioner had something like 6 textboxes in a TabItem, and the person who answered it iterated over the collection of content of the TabItem, and set each of the textbox's IsReadOnlyProperty to true. That to me looked like it would work fine, if all you have were textboxes in a TabItem. But since we'll have controls within other container controls I would think we'd have to recursively go into each container, or am I wrong about that?
Another thing is we'll be working with more than TextBoxes. We're going to also be working with CheckBoxes, ComboBoxes and an assortment of Telerik controls (RadGridView, etc.) Controls like the Checkbox doesn't have a IsReadOnly property; so the appropriate property, in the Checkbox case, would be IsEnabled. Bottom line is, assuming we use some way of iterating over the collection of controls in a TabItem, we have to have a way of differentiating between the different types of controls. How is that done? And do we have to recursively enter every container control, or will iterating over the collection of controls within the TabItem content be sufficient to visit each control there, regardless of whether or not it's in a container or not?
Rod