This is a migrated thread and some comments may be shown as answers.

[Solved] Grid View Enum Display

5 Answers 151 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Sintayehu
Top achievements
Rank 1
Sintayehu asked on 01 Sep 2009, 02:14 PM
I have an Observable collection that gets populated with Enums.

My GridView Item source is bound with this collection.

The grid column displays the numbers of the enums and not the actual desired strings.

I have verified using a debugger that I am actually gettin the strings and not the int representation of the Enums.

Binding the same collection to a text block gives me the desired string enum values.


** Interestingly**

When I set the read only attribute of the grid to false (Or leave it default) , and doble click on a cell the grid cell value actually changes to the desired string enum value.

How can I solve this issue.

 

<Controls1:RadGridView Grid.Row="0" Grid.Column="0" x:Name="ClusterGridView" IsReadOnly="true" AutoGenerateColumns="False" ColumnsWidthMode="Fill" Style="{StaticResource AutoVirtRadGridViewDefaultStyle}">

 

 

 

<Controls1:RadGridView.Columns>

 

 

 

<Controls1:GridViewDataColumn HeaderText="Server Name" UniqueName="ServerName" Width="300"/>

 

 

 

<Controls1:GridViewDataColumn HeaderText="Type" UniqueName="NodeRole" Width="300"/>

 

 

 

<Controls1:GridViewDataColumn HeaderText="Status" UniqueName="NodeStatus" Width="300"/>

 

 

 

</Controls1:RadGridView.Columns>

 

 

 

</Controls1:RadGridView>

 

 

ClusterGridView.ItemsSource = ManagementService.NodeStatusOc;


#region

Get Cluster Status completed

/// <summary>

 

 

/// Get Cluster Status completed

 

 

/// </summary>

 

 

/// <param name="faultDetail"></param>

 

 

/// <param name="clusterStatus"></param>

 

 

private void GetClusterStatusCompleted(UiFaultDetail faultDetail, ClusterStatusParametersUi clusterStatus)

{

if (faultDetail != null)

{

Dispatcher.BeginInvoke(() => new ErrorAvWindow(faultDetail));

}

else

 

 

{

Dispatcher.BeginInvoke(() =>

{

if (clusterStatus != null)

{

ClusterMainContent.Header = string.Format("{0} {1} {2}",

StringResources.

ContentHeader_Clusters,

StringResources.Cluster_Is,

clusterStatus.State);

if (!clusterStatus.State.Equals(ClusterStatus.Quorum))

{

ClusterMainContent.IsExpanded = true;

}

lock (ManagementService.NodeStatusOc)

{

if (clusterStatus.Nodes.Count > 0)

{

ManagementService.NodeStatusOc.Clear();

clusterStatus.Nodes.ForEach(nodeStatus => ManagementService.NodeStatusOc.Add(nodeStatus));

}

}

}

});

}

}

#endregion

5 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 01 Sep 2009, 02:33 PM
Hi luay,

Can you please tell me which version of Silverlight and which version of the RadGridView dlls are you testing with.

I have prepared a small app to test things here according to your scenario and everything seemed to be fine.

All the best,
Pavel Pavlov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Sintayehu
Top achievements
Rank 1
answered on 01 Sep 2009, 02:35 PM
Silverlight 2.0
Telerik\Q2_2009_724\Telerik.Windows.Controls.GridView.dll

Version  =  2009.2.724.1020
0
Pavel Pavlov
Telerik team
answered on 01 Sep 2009, 05:09 PM
Hello luay,

I would recommend to upgrade to SL3  . SL3 has some enum related problems solved.  I believe this would fix the issue.

Best wishes,
Pavel Pavlov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Sintayehu
Top achievements
Rank 1
answered on 01 Sep 2009, 05:11 PM
We can't upgrade now, is there a work around?

Did you verify this?
0
Accepted
Pavel Pavlov
Telerik team
answered on 03 Sep 2009, 12:19 PM
Hi luay,

Yes , I had this verified. This is a known issue. The only workaround I can think of is using a custom IValueConverter in order to convert enum value to their respective string representation.
This was the most common approach working around this Silverlight 2 platform problem. Now with Silverlight 3 Microsoft  have this issue fixed.

Kind regards,
Pavel Pavlov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Sintayehu
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Sintayehu
Top achievements
Rank 1
Share this question
or