wpf datagrid 得到模板中的控件

            GridViewRow s = ((GridViewRow)PSFileDataGrid.ItemContainerGenerator.ContainerFromIndex(1));
            if (s != null)
            {
                Button sb = null;
                GridViewCellBase j =
                      (from c in s.Cells where c.Column.Name == "uid" select c).FirstOrDefault();
                if (j != null)
                {
                    sb = j.Template.FindName("button1", j) as Button;
                    sb.IsEnabled = false;
                }

            }

你可能感兴趣的:(wpf datagrid 得到模板中的控件)