Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
90
How to get the HeaderRow when there are no Rows
posted

Hi,

I have a requirement to display just the columns of my empty XamWebGrid and so am trying to write a unit test to iterate over the row header cells and assert column content template UI values.  I have seen the code below to get the , but unfortunately it requires you have at least one row before you can get to the XamWebGridRowsManager,

Row r = this.DataGrid1.Rows[0];
HeaderCellControl hcc = (HeaderCellControl)((RowsManager)r.Manager).
                                              HeaderRow.Cells["IsFavorite"].Control;
if (hcc != null)
{
    CheckBox headerCB = hcc.Content as CheckBox;
}

How can I get access to the RowsManager without any rows so I can navigate iterate over the rowheader column cells.

Thanks in advance

Parents
No Data
Reply
  • 40030
    Offline posted

    Hi, 

    Currenty, we've only exposed the RowsManager publicly off of our RowBase object. 

    However, we do expose a RowsManager property off of the XamWebGrid, it's just protected.  So technically you could derive from the XamWebGrid, and expose the property yourself. 

    public class MyGrid : XamWebGrid

    {

             public XamWebGridRowsManager GridRowsManager

             {

                  get{return this.RowsManager;}

             }

    }

    Hope this helps, 

    -SteveZ

Children
No Data