How to have default ScrollViewer Enabled in a Disabled DataGrid

Dmtr_Grms 331 Reputation points
2023-06-30T12:09:33.0766667+00:00

I have a quite complicate XAML file to manage one Page in WPF.

I have a GRID that contains: 1 Grid for Search functions, 1 DataGrid that provide a list of all invoice headers, a TabControl with 2 TabITems (add, modify, delete invoice headers), a second Datagrid with all Invoice Details from the selected header.

This last DataGrid is the one that I want to modify. I would like to Disable the content of the DataGrid (in the DataGrid I have 3 buttons in a StackPanel add, modify, cancel and all the detail lines) but I want to have the default automatic ScrollViewer still Enabled. I have tried a lot of things in code-behind and in XAML. I tried to make the DataGrid ReadOnly and tried to Disable the buttons but it doesn't work Buttons and StackPanel cannot be addressed directly and if I try with a VisualTreeHelper it doesn't work. It seems that the structure is too complicate and that embedded elements are not accessible (too much level and granularity?) Has someone an idea on how to obtain my result in a quick and simple way? Thanks

Developer technologies XAML
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.