I have Telerik RadGridView. I bind IEnumerable collection where UserRole is my class which describes user's role and contains collection of permission. Imagine that collection of permissions is an array.
XAML where I bind data looks like this:
<telerik:RadGridView x:Name="grdRoles" Margin="5"
IsReadOnly="True" BorderBrush="#FF595959" BorderThickness="1"
ItemsSource="{Binding}"
AutoGenerateColumns="False" >
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn Header="Role name" DataMemberBinding="{Binding RoleName}" MinWidth="150" />
<telerik:GridViewDataColumn Header="Permissions" DataMemberBinding="{Binding Source={StaticResource something}}" MinWidth="300">
</telerik:GridViewDataColumn>
</telerik:RadGridView.Columns>
</telerik:RadGridView>
I need to convert an array with permissions to string that looks like "Perm1, Perm2, etc.." I created
<LocalControls:SettingsPage.Resources>
<ObjectDataProvider ObjectType="{x:Type LocalControls:Class1}"
MethodName="GetPermissionsString" x:Key="something">
</ObjectDataProvider>
</LocalControls:SettingsPage.Resources>
with class
public class Class1 {
public string GetPermissionsString() {
return "aaa";
}
}
According to this string
<telerik:GridViewDataColumn Header="Permissions" DataMemberBinding="{Binding Source={StaticResource something}}" MinWidth="300">
aaa is shown in Permissions column for each record in grid.
I need to pass each UserRole object to GetPermissionsString() method to convert an array to string.
The question is that I don't know how to do this. Can you give me some example?