how to use the "DataGridEnumColumn" Control

Editors for WPF Forum

Posted 12 years ago by Colin Kemp
Version: 11.2.0550
Avatar
Question,

I have a datagrid that I want to show Enum's by using the "DataGridEnumColumn" control.
Could someone please provide a sample on how to accomplish this in xaml?

Regards,
Colin

Comments (7)

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Colin,

An example would be:
<datagrideditors:DataGridEnumColumn Binding="{Binding LicenseState}" MinWidth="100"
        MinDropDownHeight="175" MinDropDownWidth="175" Header="License State" />
You can drop that into our License Dashboard demo to see it in action. You will also need to add the following property to the Customer class:
public LicenseState LicenseState { get; set; }


Actipro Software Support

Posted 12 years ago by Colin Kemp
Avatar
I think I need to clarify my question.

Here is the scenerio. My Datagrid's ItemsSource is a Data Tables Default View.
Here is a XAML Code Sample

<DataGridEditors:DataGridEnumColumn
                                x:Name="m_MyColumn"
                                Header="My Column"
                                Binding="{Binding Path=MyColumn}"
                                EnumType="{x:Type Enums:MyEnum}"
                                MinWidth="150"/>
the Drop Down List Populates with no problem. Here are the issues that I am running into

** I can not display the current Value From the DataTable.
** I can not update that value.

Do I need to implement a Converter?

Any help would be greatly appreciated.

Colin

[Modified at 12/08/2011 09:47 AM]
Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Colin,

If the underlying type in the DataType is not MyEnum, but instead a string or int. Then yes, you'd probably have to build a custom IValueConverter and use that in the Binding.


Actipro Software Support

Posted 11 years ago by Craig - Varigence, Inc.
Avatar

If I double click on a DataGridCell in a DataGridEnumColumn, should the cell display a textbox or a dropdown? I ask since the EnumPartTextBox  uses dropdowns but when I double click on a cell in a DataGridEnumColumn, all I see is a textbox.

Thanks,

-Craig

Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
H Craig,

Try setting the column's IsEditable property to false and see if that helps.


Actipro Software Support

Posted 11 years ago by Craig - Varigence, Inc.
Avatar

I gave this shot but it still doesn't work. I'm sending a sample over that demonstates the problem.

Thanks,

-Craig

Answer - Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Craig,

Sorry that was our bug.  The DataGridEnumColumn.DropDownButtonVisibility property should have been defaulting to true but it currently is defaulting false.  You can set it in your XAML to true until the next version.  Also you can take the IsEditable setting back out too.


Actipro Software Support

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.