protected override void SetupRepositoryItem(RepositoryItem item)
 {
     base.SetupRepositoryItem(item);
     if (TypeHasFlagsAttribute())
     {
         RepositoryItemCheckedComboBoxEdit checkedItem = ((RepositoryItemCheckedComboBoxEdit)item);
         checkedItem.BeginUpdate();
         checkedItem.Items.Clear();
         noneValue = GetNoneValue();
         //checkedItem.SelectAllItemVisible = false;
         //Dennis: this is required to show localized items in the editor.
         foreach (object value in EnumDescriptor.Values)
         {
             if (!IsNoneValue(value))
             {
                 checkedItem.Items.Add(value, EnumDescriptor.GetCaption(value), CheckState.Unchecked, true);
             }
         }
         //Dennis: use this method if you don't to show localized items in the editor.
         //checkedItem.SetFlags(GetUnderlyingType());
         checkedItem.EndUpdate();
         checkedItem.ParseEditValue    += checkedEdit_ParseEditValue;
         checkedItem.CustomDisplayText += checkedItem_CustomDisplayText;
         checkedItem.Disposed          += checkedItem_Disposed;
     }
 }
Beispiel #2
0
 protected override void SetupRepositoryItem(RepositoryItem item)
 {
     base.SetupRepositoryItem(item);
     if (TypeHasFlagsAttribute())
     {
         RepositoryItemCheckedComboBoxEdit checkedItem = ((RepositoryItemCheckedComboBoxEdit)item);
         checkedItem.BeginUpdate();
         noneValue = GetNoneValue();
         checkedItem.SetFlags(GetUnderlyingType());
         //Dennis: this is required to show localized items in the editor.
         foreach (CheckedListBoxItem itm in checkedItem.Items)
         {
             itm.Description = EnumDescriptor.GetCaption(itm.Value);
         }
         checkedItem.EndUpdate();
         checkedItem.ParseEditValue    += checkedEdit_ParseEditValue;
         checkedItem.CustomDisplayText += checkedItem_CustomDisplayText;
         checkedItem.Disposed          += checkedItem_Disposed;
     }
 }