SelectedItem of gridview inside combo

4 posts, 0 answers
  1. Gilberto
    Gilberto avatar
    65 posts
    Member since:
    Sep 2006

    Posted 23 Aug 2011 Link to this post

    I am using one grid inside radcombobox just like the xaml bellow.


    <telerik:RadComboBox DisplayMemberPath="Descricao" Name="radComboBoxResultado" Grid.Column="2" StaysOpenOnEdit="True" Height="26">             <telerik:RadComboBox.Items>                 <telerik:RadComboBoxItem>                     <telerik:RadComboBoxItem.Template>                         <ControlTemplate>                             <Grid>                                 <Grid.RowDefinitions>                                     <RowDefinition Height="*"></RowDefinition>                                     <RowDefinition Height="*"></RowDefinition>                                 </Grid.RowDefinitions>                                 <telerik:RadGridView  x:Name="RadGridView" AutoGenerateColumns="False" ShowGroupPanel="False" CanUserFreezeColumns="False"                                               RowIndicatorVisibility="Collapsed" IsReadOnly="True" MinWidth="300" MaxWidth="600"                                              IsFilteringAllowed="False" ItemsSource="{Binding PagedSource, ElementName=RadDataPager}" SelectionChanged="RadGridView_SelectionChanged"                                              Height="150" SelectedItem="{Binding SelectedItem, Mode=TwoWay}" Loaded="RadGridViewResultadoBusca_Loaded">                                     <telerik:RadGridView.Columns>                                         <telerik:GridViewDataColumn Header="Referência" Width="120" DataMemberBinding="{Binding CodigoProduto}" IsReadOnly="True"></telerik:GridViewDataColumn>                                         <telerik:GridViewDataColumn Header="Produto" Width="*" DataMemberBinding="{Binding Descricao}" IsReadOnly="True"></telerik:GridViewDataColumn>                                         <telerik:GridViewDataColumn Header="Venda" Width="*" DataMemberBinding="{Binding ValorVenda}" DataFormatString="C2"  IsReadOnly="True"></telerik:GridViewDataColumn>                                     </telerik:RadGridView.Columns>                                 </telerik:RadGridView>                                 <telerik:RadDataPager Name="RadDataPager" Grid.Row="1" DisplayMode="FirstLastNumeric,Last" PageSize="20" Loaded="RadDataPager_Loaded"></telerik:RadDataPager>                             </Grid>                         </ControlTemplate>                     </telerik:RadComboBoxItem.Template>                 </telerik:RadComboBoxItem>             </telerik:RadComboBox.Items>         </telerik:RadComboBox>

    Everything is ok but when i select the row in grid i'd like the text to appear in Text property of RadcomboBox  .

    I've tried to binding the selected items together, and does not works, as well as, implement the selectedChnaged of the grid to set the combo.Text property with no success.

    How can i achieve this?

  2. Yana
    Yana avatar
    4547 posts

    Posted 25 Aug 2011 Link to this post

    Hi Gilberto,

    Please check this blog post where a similar approach is demonstrated - note how the Text property of the RadComboBox is binded.

    Hope this helps.

    Kind regards,
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  3. DevCraft R3 2016 release webinar banner
  4. Jeff
    Jeff avatar
    1 posts
    Member since:
    Oct 2013

    Posted 04 Jun 2014 Link to this post

    The new link to the blog post referenced above:
  5. Yana
    Yana avatar
    4547 posts

    Posted 05 Jun 2014 Link to this post

    Hello Jeff,

    Thank you for re-posting the link.

    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
Back to Top