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

Binding to other GridView Column

2 Answers 25 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Veteran
Iron
Michael asked on 28 Nov 2012, 02:21 PM
Hallo Telerik Team,

is it possible to bind to an other column value of an GridView.

I have a GridView with 3 columns like this:

<Telerik:RadGridView x:Name="xSensorDaten" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2"
             ItemsSource="{Binding Path=SensorDaten, Mode=TwoWay}"
             IsFilteringAllowed="False" RowHeight="25"
             CanUserFreezeColumns="False" RowIndicatorVisibility="Collapsed"
             ShowGroupPanel="False" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
             VerticalContentAlignment="Top" AutoGenerateColumns="False" RowDetailsVisibilityMode="Visible"
             CanUserInsertRows="True" AddingNewDataItem="OnSensorDaten_AddingNewDataItem">
    <Telerik:RadGridView.Columns>
        <Telerik:GridViewComboBoxColumn DataMemberBinding="{Binding SensorDatenBeschreibungId, Mode=TwoWay}"
                           SelectedValueMemberPath="Id" Width="300"
                           ItemsSource="{Binding ElementName=xSensorDatenBeschreibungFuerAuswahlDDS, Path=DataView}"
                           Header="Name">
            <Telerik:GridViewComboBoxColumn.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding Name}"/>
                        <TextBlock Text=" ["/>
                        <TextBlock Text="{Binding EinheitDefinition.Zeichen}"/>
                        <TextBlock Text="]"/>
                    </StackPanel>
                </DataTemplate>
            </Telerik:GridViewComboBoxColumn.ItemTemplate>
        </Telerik:GridViewComboBoxColumn>
 
        <Telerik:GridViewDataColumn Width="200" DataMemberBinding="{Binding Path=Wert, Mode=TwoWay}"
                         Header="Wert" />
 
        <Telerik:GridViewDataColumn Width="100" DataMemberBinding="{Binding}"
                         Header="Einheit"
                         IsReadOnly="True"/>
    </Telerik:RadGridView.Columns>
</Telerik:RadGridView>

And i want to bind the 3rd Column (GridViewDataColumn) to the SelectedItem of the 1st Column (GridViewComboBoxColumn).

Thx Mike

2 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 29 Nov 2012, 01:56 PM
Hi,

 When you select an item in your combo column you will actually update the underlying property bound to this column. You can simply bind your other column to the same property. 

All the best,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Michael
Top achievements
Rank 1
Veteran
Iron
answered on 29 Nov 2012, 02:26 PM
Hi Vlad,

do you mean to bind my other column to the xSensorDatenBeschreibungFuerAuswahlDDS Element?
Or do you mean the comboboxcolumn?

How can i bind a GridView Column property to an other column property.
i have more than one GridView items.

thx mike
Tags
GridView
Asked by
Michael
Top achievements
Rank 1
Veteran
Iron
Answers by
Vlad
Telerik team
Michael
Top achievements
Rank 1
Veteran
Iron
Share this question
or