This question is locked. New answers and comments are not allowed.
I have a grid that contains a field with a foreign key to a lookup table.
Table1
Id
Name
Table2Id
Table2
Id
Name
Using a normal grid row I would normally display the Table2Id using a RadComboBox like follows to display the text:
Now I want to go from a normal row to a custom row like the one in the demos:
http://demos.telerik.com/silverlight/#GridView/CustomRowLayout
Currently I am getting the text for the name by doing a round about way:
Basically I have a StackPanel that contains a TextBlock and a RadComboBox making the RadComboBox that is bound to the datasource invisible and setting the text of the TextBlock to the SelectedItem of the RadComboBox:
The problem with this route it that it takes a lot of work to hook the commands up and get the data loaded. Is there any other way to do that will be much more maintainable and easier to setup? I guess what I am looking for is the easiest way to get the foreign key data in the custom row.
On the demo page above it would be like the Title field coming from a look up table instead of text from the main data source.
Thanks,
Jason
Table1
Id
Name
Table2Id
Table2
Id
Name
Using a normal grid row I would normally display the Table2Id using a RadComboBox like follows to display the text:
<
telerik:GridViewComboBoxColumn
MinWidth
=
"80"
DataMemberBinding
=
"{Binding Table2Id}"
DisplayMemberPath
=
"Name"
Header
=
"Table2 Name"
IsReadOnly
=
"True"
SelectedValueMemberPath
=
"Id"
ShowColumnWhenGrouped
=
"False"
TextWrapping
=
"NoWrap"
UniqueName
=
"Table2Id"
/>
Now I want to go from a normal row to a custom row like the one in the demos:
http://demos.telerik.com/silverlight/#GridView/CustomRowLayout
Currently I am getting the text for the name by doing a round about way:
Basically I have a StackPanel that contains a TextBlock and a RadComboBox making the RadComboBox that is bound to the datasource invisible and setting the text of the TextBlock to the SelectedItem of the RadComboBox:
<
StackPanel
>
<
TextBlock
Margin
=
"2"
HorizontalAlignment
=
"Left"
VerticalAlignment
=
"Center"
Text="{Binding
ElementName
=
Table2sList
,
Path
=
SelectedItem
,
Converter={StaticResource table2Converter}}" />
<
telerik:RadComboBox
Name
=
"Table2sList"
HorizontalAlignment
=
"Left"
VerticalAlignment
=
"Center"
SelectedValue
=
"{Binding Table2Id}"
SelectedValuePath
=
"Id"
Visibility
=
"Collapsed"
>
<
Interactivity:Interaction.Triggers
>
<
Interactivity:EventTrigger
EventName
=
"Loaded"
>
<
gala:EventToCommand
Command="{Binding DataContext.Table2sListLoadedCommand,
ElementName
=
View
}"
CommandParameter
=
"{Binding ElementName=Table2sList}"
PassEventArgsToCommand
=
"True"
/>
</
Interactivity:EventTrigger
>
</
Interactivity:Interaction.Triggers
>
</
telerik:RadComboBox
>
</
StackPanel
>
The problem with this route it that it takes a lot of work to hook the commands up and get the data loaded. Is there any other way to do that will be much more maintainable and easier to setup? I guess what I am looking for is the easiest way to get the foreign key data in the custom row.
On the demo page above it would be like the Title field coming from a look up table instead of text from the main data source.
Thanks,
Jason