Beispiel #1
0
        private void nameColumn_Expand(object sender, MemberWrapperEventArgs e)
        {
            using (new LongRunningMonitor(this))
            {
                int index = m_properties.IndexOf(e.Wrapper);
                Debug.Assert(index != -1, "index != -1");
                Debug.Assert(!e.Wrapper.ValueIsNullOrUnavailable, "Trying to expand a null or unavailable value.");

                CellEditorData cellData = (CellEditorData)e.Wrapper.Tag;
                Debug.Assert(!cellData.IsExpanded, "Expanding an already expanded row.");

                // Create a new GenericWrapper object for the expanded value and get its properties.

                GenericWrapper genericWrapper = e.Wrapper.CreateWrapper();
                Debug.Assert(genericWrapper != null, "CreateWrapper() returned null for the member being expanded.");
                cellData.Children = genericWrapper.GetMembers();

                foreach (MemberWrapper childProperty in cellData.Children)
                {
                    childProperty.SetValueFormat(m_valueFormat);
                    childProperty.Tag           = new CellEditorData(childProperty, cellData.Level + 1, cellData);
                    childProperty.ValueChanged += new EventHandler(m_handler.ItemValueChanged);
                    m_properties.Insert(++index, childProperty);
                }

                if (cellData.Children.Count == 0)
                {
                    ((DataGridExpandableColumn)sender).Invalidate();
                }
                else
                {
                    ((CellEditorData)cellData.Children[cellData.Children.Count - 1].Tag).IsLastInLevel = true;
                }
            }
        }
Beispiel #2
0
        public void DisplayValue(GenericWrapper value)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value", "This editor cannot display a null value.");
            }

            m_wrapper = value;
            DisplayValueInternal(m_wrapper.GetMembers());
        }