With the class that I send you you can use the Extension method GetChildren
(for UIElements), use the recursive overload to find a ToggleButton, it
should look something like

datagrid.GetChildren<ToggleButton>(true);

This will return an IEnumerable of all the ToggleButtons in the DataGrid.
This might include the ones used for sorting in the Header. TO exclude them,
hou could get to the DataGridRowsPresenter (you should only have one) and
then find all the Toggles there.

dataGrid.GetChild<DataGridRowsPresenter>(true).GetChildren<ToggleButton>();

I'm not sure if I wrote a generic GetChild, but you could use

dataGrid.GetChildren<DataGridRowsPresenter>(true).First().GetChildren<ToggleButton>();


If you don't use this helpers (or somethign similar), finding things in the
tree is a mess and error prone with controls like the Datagrid that heavily
use templates.


-- 
Miguel A. Madero Reyes
www.miguelmadero.com (blog)
[email protected]
_______________________________________________
ozsilverlight mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight

Reply via email to