Hi Gary,
As for the DataGrid's Columns collection, when one of the DataGridColumn's
Visible it set to false (at design-time or runtime), it will not directly
change the underlying Cell(in the certain DataGridRow)'s Visible property
because at that time the certain Row or Cell may still hasn't been
constructed or initialized completely. I've checked the disassembly code
of the DataGrid control, the actual code logic for applying the
DataGridColumn.Visible is as below:
** we set a certain column's Visible to false (at design-time or runtime)
** the DataGrid still create each DataGridRow and cells in each row as
normal (without set the visible property on each cell)
** in the DataGrid.Render method, it will call a "PrepareControlHierarchy"
method and in this method the DataGrid will loop through all the columns
and apply the certain DataGridColumn.Visible setting to the corresponding
Cell.
Therefore, for your scenario, if you want to detect a certain Cell's
visibility, you can not use the "Visible" property since it is not
synchorized with the Column's Visible before rendering. I suggset you check
the Column's Visible property from the DataGrid's Columns collection and
determine the corresponding Cell(by index)'s visible setting. How do you
think of this?
Please feel free to let me know if you have any other concerns or questions
here.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.