CellTemplate as ComboBox Changes Value in All Rows

2 posts, 0 answers
  1. Robert Kaucher
    Robert Kaucher avatar
    56 posts
    Member since:
    Oct 2010

    Posted 03 Mar 2011 Link to this post

    I have aRadGridView controm populated by a DOmainDataSource. It populates teh GridView with information about part objects.

     I have another DomainDataSource that is configured as a static resource in XAML and is used to populate a combobox with ForecastOwner objects. These are associated objects of the Part objects.

    Part * => 1 ForecastOwner

    I have the column celltemplate defined as this:
    <telerik:GridViewDataColumn.CellTemplate>
        <DataTemplate>
            <ComboBox
                ItemsSource="{Binding Data, Source={StaticResource forecastOwnerDomainDataSource}, Mode=TwoWay}"
                SelectedValue="{Binding ForecastOwnerID, Mode=TwoWay}"
                SelectedValuePath="ForecastOwnerID"
                DisplayMemberPath="FullName" />
        </DataTemplate>
    </telerik:GridViewDataColumn.CellTemplate>
    The issue I am having is that when I define it as a CellTemplate when I make a selection change it changes the field in every row of the GridView, not just the selected row.

    When I define it as CellEditTemplate nothing, no text at all, is displayed until I click in the cell. If I define both a CellTemplate and a CellEditTemplate (say CellTemplate as a TextBox) it over rides the CellEditTemplate. No big deal, I define the CellTemplate as a TextBlock and it works UNTIL I change the selection and then, of course, I have nothing displayed in that cell because the TextBlock is bound to the Part's associated ForecastOwner's FullName Property. So I assume I need some sort of value converter, but I am a little stumped. Thank you in advance for your help.
  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 07 Mar 2011 Link to this post

    Hi Robert,

    May you try to use RadComboBox instead of ComboBox? Furthermore, you may benefit from the GridViewComboBoxColumn.
     
     

    Regards,
    Maya
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  3. DevCraft banner
Back to Top