Home Forums WinForms controls Xceed Grid for WinForms Grid ComboBoxEditor … text align, images and a few other questions

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #16687 |

    We are currently evaluating Xceed Grid .NET and are having a few problems with the ComboBoxEditor.

    We use unbound grids and populate them from type-safe Lists which are populated from database data. For one particular cell we would like to give the user the option to select YES or NO. Sounds simple enough.

    The combo will display a green icon for YES and a red one for NO, both of these images are stored in a resource file (gif).

    The underlying ID’s are YES=1, NO=0. Don’t worry about checkbox implementation etc, this is the first step before we introduce more options to the user. For this exercise lets leave it as simple YES/NO.

    Problem 1;
    We are getting the combo to appear OK however the text is aligned to the left. The underlying column text alignment is to the right. No matter what we do, we cannot change the text alignment of either one. In design mode, the column is aligned to the left however after we run the project the text is right aligned. The column is of type Int32.

    Problem 2;
    The underlying ID will remain hidden from the user. Only the icon and text will be displayed. We can set the ImageMember to the correct column however none of the Image commands, i.e. ImageAlignment, ImagePosition seem to have any effect. The icon is also appearing in the combo but aligned to the top left. We would like it in the center of the column/row.

    Problem 3;
    When we select an item from the combo, the underlying cell value does not change to reflect this. I would have thought this was automatic. How do we change the cell value to the selected combo item.

    Problem 4;
    Are we doing the correct thing for images. Do we create a column in the combo for an image and then also set this column as the ImageMember? Please keep in mind this combo is entirely unbound.

    Problem 5;
    How do we set the DisplayFormat so that the icon will be displayed as well as the text. If we include the column name for the icon, i.e. %icon% %text% we are getting the .ToString() displayed in the cell, i.e. System.Drawing.Bitmap when it should simply show the icon.

    Any help is appreciated on a very flexible product. We just need to get used to its operation.

    Imported from legacy forums. Posted by Paligap (had 1222 views)

    User (Old forums)
    Member
    Post count: 23064

    Problem 1 :

    Columns with a numeric DataType are always right aligned.  You should be able to change this by setting the HorizontalAlignment property on the Column.

    Problem 2 :

    ImagePosition and ImageAlignment should work, we’d have to see what you do exactly to understand why it does not work.  However, the image can only be at the left or right of the DisplayFormat, so it is not possible to put it right in the center.  The only solution for that would be to create your own custom viewer and editor, so the image is always in centered.

    Problem 3 :

    The cell value is automatically updated, no need to do anything special.  The only reason I can see why it does not update is that there is an exception being throw but that is swallowed by the grid or the .NET framework.  Is your debugger set to break on all exceptions?.  Go to Debug Menu -> Exceptions -> Common Language Runtime Exceptions, and select “Thrown” CheckBox.  Also make sure the “Enable Just My Code” CheckBox is unselected (Tools Menu -> Options -> Debugging -> General) if you’re using VS 2005 or up.  This will make sure that no exceptions are swallowed by the grid or the framework, and that the debugger will break in any part of the code, not just yours.

    Problem 4 :

    Yes.

    Problem 5 :

    DisplayFormat is for text formating, not image.  The image is set through the ImageMember.

     

    If you look at our Extensibility sample, it actually uses a ComboBox with an image and a text, so it should give you want you need to accomplish what you want.

    Under Vista, by default it installs here :

    C:\Xceed Component Samples\Xceed Grid for .NET 3.8\Samples\CSharp\Extensibility

    Under XP, it installs here :

    C:\Program Files\Xceed Components\Xceed Grid for .NET 3.8\Samples\CSharp\Extensibility

     

    Imported from legacy forums. Posted by André (had 1341 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.