Binding to other GridView Column

3 posts, 0 answers
  1. Michael
    Michael avatar
    59 posts
    Member since:
    Jan 2012

    Posted 28 Nov 2012 Link to this post

    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. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 29 Nov 2012 Link to this post

    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.

  3. Michael
    Michael avatar
    59 posts
    Member since:
    Jan 2012

    Posted 29 Nov 2012 Link to this post

    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
Back to Top