I have an ConfigurationGroup object that contains ConfigurationGroupParameters. I want to display this in an hierarchic Grid. The relationship between the parameters and their configuration group is built dynamically as I receive data from my server.
Upon my first setParameters, the grid view displays my Groups as expandable, but no data is available when I try to expand them (and no sub grid appears). Upon my second receive I am able to display the parameter sub grid in my grid, but data is only available for the first Configuration group, the second, most recent set, group becomes empty.
I tried to do a work around by adding a dummy relationship with unique name after adding a parameter group. This made my data visible after the first receive. But on the second receive the m_GridView.Relations.Add() row throws an exception (Object set to null).
Is there something obvious missing in the code below, or is this a bug?
Upon my first setParameters, the grid view displays my Groups as expandable, but no data is available when I try to expand them (and no sub grid appears). Upon my second receive I am able to display the parameter sub grid in my grid, but data is only available for the first Configuration group, the second, most recent set, group becomes empty.
I tried to do a work around by adding a dummy relationship with unique name after adding a parameter group. This made my data visible after the first receive. But on the second receive the m_GridView.Relations.Add() row throws an exception (Object set to null).
Is there something obvious missing in the code below, or is this a bug?
| public void SetConfigurationGroupParameters(ConfigurationGroup configurationGroup) |
| { |
| m_GridView.GridElement.BeginUpdate(); |
| bool isNewConfigurationGroup = !m_ParameterBinder.ContainsKey(configurationGroup); |
| #region Get Template |
| GridViewTemplate template = null; |
| if (isNewConfigurationGroup) |
| { |
| template = new GridViewTemplate(m_GridView); |
| template.AllowAddNewRow = false; |
| m_ParameterBinder.Add(configurationGroup, template); |
| #region Create Columns |
| template.AutoGenerateColumns = false; |
| template.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; |
| Collection<GridViewColumn> columns = CreateColumns(Presenter.GetParameterColumns()); |
| foreach (GridViewColumn column in columns) |
| { |
| template.Columns.Add(column); |
| } |
| #endregion |
| } |
| template = m_ParameterBinder[configurationGroup]; |
| #endregion |
| if (configurationGroup.Parameters != null) |
| { |
| template.DataSource = configurationGroup.Parameters; |
| #region Arrange Relationship |
| GridViewRelation relation = new GridViewRelation(m_GridView.MasterGridViewTemplate); |
| relation.RelationName = "ConfigurationGroupsParameters." + configurationGroup.ConfigurationGroupOId; |
| relation.ParentColumnNames.Add("ConfigurationGroupOId"); |
| relation.ChildColumnNames.Add("ConfigurationGroupOId"); |
| relation.ChildTemplate = template; |
| m_GridView.Relations.Add(relation); |
| m_GridView.MasterGridViewTemplate.ChildGridViewTemplates.Add(template); |
| #endregion |
| } |
| m_GridView.GridElement.EndUpdate(); |
| } |