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

Problem setting ItemsSource of ComboBoxColumn in RowDetails

2 Answers 139 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Alex Mitchell
Top achievements
Rank 1
Alex Mitchell asked on 14 Apr 2010, 05:26 PM
Hello,

Currently I am trying to set the ItemsSource of a ComboBoxColumn that is in a grid in my RowDetails for a higher level Grid. I would a child table but I currently have other controls in the RowDetails I am binding to plus I don't really think that will fix my problem.

<telerik:RadGridView.RowDetailsTemplate> 
    <DataTemplate> 
        <Grid> 
            <TextBlock Margin="125,8,0,0" Text="Rate" TextWrapping="Wrap" TextAlignment="Center" Height="17.001" VerticalAlignment="Top" HorizontalAlignment="Left" Width="70" /> 
            <telerik:RadMaskedTextBox HorizontalContentAlignment="Right" Mask="P" MaskType="Numeric" Margin="127.007,25.001,406,0" HorizontalAlignment="Left" VerticalAlignment="Top" Height="19.96" Width="67.993" /> 
            <telerik:RadGridView AutoGenerateColumns="False" ItemsSource="{Binding Path=Payments, Mode=TwoWay}" Margin="8,53,8,8" ShowGroupPanel="False" AreRowDetailsFrozen="True" > 
                <telerik:RadGridView.Columns> 
                    <telerik:GridViewComboBoxColumn ItemsSource="{Binding Path=AllTypes}" DisplayMemberPath="Type" DataMemberBinding="{Binding Path=TypeOfPayment}"/> 
                    <telerik:GridViewDataColumn  Header="Event" DataMemberBinding="{Binding Path=TypeOfPayment.Type, Mode=TwoWay}" /> 
                    <telerik:GridViewDataColumn Header="Amount" TextAlignment="Right" DataMemberBinding="{Binding Path=Amount, Mode=TwoWay}" DataFormatString="{}{0:c}" /> 
                    <telerik:GridViewDataColumn Header="Number" TextAlignment="Right" DataMemberBinding="{Binding Path=Term, Mode=TwoWay}" /> 
                    <telerik:GridViewDataColumn Header="Period" TextAlignment="Right" DataMemberBinding="{Binding Path=Period, Mode=TwoWay}" /> 
                    <telerik:GridViewDataColumn Header="Notes" TextAlignment="Right" DataMemberBinding="{Binding Path=Notes, Mode=TwoWay}" /> 
                </telerik:RadGridView.Columns> 
                <Navigation:RadContextMenu.ContextMenu> 
                    <Navigation:RadContextMenu Opened="RadContextMenu_Opened" ItemClick="RadContextMenu_ItemClick"
                        <Navigation:RadContextMenu.Items> 
                            <Navigation:RadMenuItem Header="Add" /> 
                            <Navigation:RadMenuItem Header="Delete" /> 
                        </Navigation:RadContextMenu.Items> 
                    </Navigation:RadContextMenu> 
                </Navigation:RadContextMenu.ContextMenu> 
            </telerik:RadGridView> 
            <Button Style="{DynamicResource RoundButton}" Click="btnClick" Foreground="{DynamicResource CalculateIcon}" Height="39" HorizontalAlignment="Right" Margin="0,8,8,0" Name="btnGenerate" VerticalAlignment="Top" Width="44">Button</Button> 
        </Grid> 
    </DataTemplate> 
</telerik:RadGridView.RowDetailsTemplate> 


In the code block above, I tried binding the ItemsSource in the Xaml file to a property that returns a List<T> of what I want to bind to but the combo box shows no options to select which makes me believe that nothing was being loaded into the ItemsSource even though the debugger shows that the property is being accessed. I have also tried to find a way to access the comboboxcolumn in code but I cannot figure out how to access the controls in the RowDetails. If I did something wrong in my binding or if there is someway I could set the ItemsSource, even manually in either Xaml or code, for the ComboBoxColumn in a Grid in my RowDetails, then that would be most helpful.

Alex Mitchell

2 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 19 Apr 2010, 09:54 AM
Hello Alex Mitchell,

Please try to use the ItemsSourceBinding property instead of the ItemsSource property for the ComboBoxColumn ( I see you are using a binding) . When using this property you might need to place your ItemsSource in a StaticResource so that you can easily refer to it. In case this does not help , just let me know , and I will try to gather  small sample app for you.

Regards,
Pavel Pavlov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Alex Mitchell
Top achievements
Rank 1
answered on 19 Apr 2010, 05:35 PM
Thank you, that fixed the problem without having to set the data as a static resource.

Alex Mitchell
Tags
GridView
Asked by
Alex Mitchell
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Alex Mitchell
Top achievements
Rank 1
Share this question
or