Example #1
0
 protected virtual void OnItemChanged(object sender, ItemEventArgsType e, ComboBoxArgs args)
 {
     this.ResetCachedBounds();
     if (this.ItemChanged != null)
     {
         this.ItemChanged(sender, e, args);
     }
 }
Example #2
0
        internal void OnItemChange(object sender, ItemEventArgsType e, ComboBoxArgs args)
        {
            ListItem     item     = (ListItem)sender;
            ItemTemplate template = this.GetTemplate(item);

            switch (e)
            {
            case ItemEventArgsType.Selection:
                if (this.m_selectedItem != null)
                {
                    ListItem selectedItem = this.m_selectedItem;
                    this.m_selectedItem = null;
                    if (selectedItem != item)
                    {
                        selectedItem.Selected = false;
                    }
                }
                this.m_selectedItem = item;
                return;

            case ItemEventArgsType.TemplateIndex:
            {
                ComboBoxIndexChangedArgs args2 = args as ComboBoxIndexChangedArgs;
                if (args2 == null)
                {
                    throw new ArgumentException("Wrong argument type. args must be of type ComboBoxIndexChangedArgs.", "args");
                }
                int d = -this.GetTemplate(item, args2.OldTemplateIndex).GetHeight(item);
                item.ResetCachedBounds();
                d += template.GetHeight(item);
                this.OnChanged(this, ComboBoxEventArgsType.Resize, new ComboBoxScrollArgs(d, base.List.IndexOf(item)));
                return;
            }
            }
            if (template.AutoHeight)
            {
                int actualHeight = item.ActualHeight;
                item.ResetCachedBounds();
                int height = template.GetHeight(item);
                if (height != actualHeight)
                {
                    this.OnChanged(this, ComboBoxEventArgsType.Resize, new ComboBoxScrollArgs(height - actualHeight, base.List.IndexOf(item)));
                    return;
                }
            }
            this.OnChanged(this, ComboBoxEventArgsType.ItemChange, new ComboBoxScrollArgs(0, base.List.IndexOf(item)));
        }
Example #3
0
 protected virtual void OnItemChanged(object sender, ItemEventArgsType e, ComboBoxArgs args)
 {
     this.ResetCachedBounds();
     if (this.ItemChanged != null)
     {
         this.ItemChanged(sender, e, args);
     }
 }
Example #4
0
        internal void OnItemChange(object sender, ItemEventArgsType e, ComboBoxArgs args)
        {
            ListItem item = (ListItem) sender;
            ItemTemplate template = this.GetTemplate(item);
            switch (e)
            {
                case ItemEventArgsType.Selection:
                    if (this.m_selectedItem != null)
                    {
                        ListItem selectedItem = this.m_selectedItem;
                        this.m_selectedItem = null;
                        if (selectedItem != item)
                        {
                            selectedItem.Selected = false;
                        }
                    }
                    this.m_selectedItem = item;
                    return;

                case ItemEventArgsType.TemplateIndex:
                {
                    ComboBoxIndexChangedArgs args2 = args as ComboBoxIndexChangedArgs;
                    if (args2 == null)
                    {
                        throw new ArgumentException("Wrong argument type. args must be of type ComboBoxIndexChangedArgs.", "args");
                    }
                    int d = -this.GetTemplate(item, args2.OldTemplateIndex).GetHeight(item);
                    item.ResetCachedBounds();
                    d += template.GetHeight(item);
                    this.OnChanged(this, ComboBoxEventArgsType.Resize, new ComboBoxScrollArgs(d, base.List.IndexOf(item)));
                    return;
                }
            }
            if (template.AutoHeight)
            {
                int actualHeight = item.ActualHeight;
                item.ResetCachedBounds();
                int height = template.GetHeight(item);
                if (height != actualHeight)
                {
                    this.OnChanged(this, ComboBoxEventArgsType.Resize, new ComboBoxScrollArgs(height - actualHeight, base.List.IndexOf(item)));
                    return;
                }
            }
            this.OnChanged(this, ComboBoxEventArgsType.ItemChange, new ComboBoxScrollArgs(0, base.List.IndexOf(item)));
        }