populate radcombobox dynamically

3 posts, 0 answers
  1. cielo valdoz
    cielo valdoz avatar
    33 posts
    Member since:
    Dec 2009

    Posted 26 Apr 2010 Link to this post

    Hi,

    Im populating the radcombo box dynamically and getting the data from sql using a webservice. The combo box at the upper part of the page works fine but at the lower part, it generates an error everytime i expand the combo box. I placed the combobox inside the RadExpander.
    <Border BorderBrush="White" BorderThickness="3" CornerRadius="5" Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Stretch" Grid.ColumnSpan="2" Grid.Column="1" Height="Auto"
                            <StackPanel Margin="0,0,0,0" Height="Auto" VerticalAlignment="Stretch"
                                <telerik:RadExpander IsExpanded="True" ExpandDirection="right" Name="RadExpanderOptions" VerticalAlignment="Stretch" Height="805"
                                    <telerik:RadExpander.Content> 
                                            <telerik:RadWrapPanel x:Name="imageContainer" IsAnimated="False" Orientation="Horizontal" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                                                <Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0,0,0,0"
                                                    <Grid.RowDefinitions> 
                                                        <RowDefinition Height="Auto" /> 
                                                        <RowDefinition Height="Auto"/> 
                                                        <RowDefinition Height="Auto"/> 
                                                        <RowDefinition Height="Auto"/> 
                                                        <RowDefinition Height="Auto"/> 
                                                    </Grid.RowDefinitions> 
                                                <StackPanel Grid.Row="0" VerticalAlignment="Stretch"
                                                    <telerik:RadExpander IsExpanded="True" ExpandDirection="down" Name="RadExpanderSalesItemIncluded" VerticalAlignment="Stretch"
                                                        <telerik:RadExpander.Header> 
                                                            <TextBlock Text="Sales item included" Foreground="white" /> 
                                                        </telerik:RadExpander.Header> 
                                                        <telerik:RadExpander.Content> 
                                                            <telerik:RadWrapPanel IsAnimated="False" Orientation="Horizontal" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                                                                <Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0,0,0,0" > 
                                                                    <Grid.ColumnDefinitions> 
                                                                        <ColumnDefinition /> 
                                                                    </Grid.ColumnDefinitions> 
                                                                    <Grid.RowDefinitions> 
                                                                        <RowDefinition /> 
                                                                        <RowDefinition /> 
                                                                        <RowDefinition /> 
                                                                        <RowDefinition /> 
                                                                    </Grid.RowDefinitions> 
                                                                    <StackPanel Grid.Row="0" VerticalAlignment="Stretch"
                                                                        <Grid> 
                                                                            <Grid.ColumnDefinitions> 
                                                                                <ColumnDefinition Width="20" /> 
                                                                                <ColumnDefinition /> 
                                                                            </Grid.ColumnDefinitions> 
                                                                            <CheckBox x:Name="chkSalesItemAll" Grid.Column="0" /> 
                                                                            <TextBlock Text="All" Foreground="White" Grid.Column="1"/> 
                                                                        </Grid> 
                                                                    </StackPanel> 
                                                                    <StackPanel Grid.Row="1" VerticalAlignment="Stretch"
                                                                        <Grid> 
                                                                            <Grid.ColumnDefinitions> 
                                                                                <ColumnDefinition Width="20"/> 
                                                                                <ColumnDefinition /> 
                                                                            </Grid.ColumnDefinitions> 
                                                                            <CheckBox x:Name="chkMOD" IsChecked="false" Grid.Column="0"  Margin="0,0,5,0"/>  
                                                                            <TextBlock Text="Menu of the day" Grid.Column="1" Foreground="white" Margin="0,0,5,0"/> 
                                                                             
                                                                        </Grid> 
                                                                    </StackPanel> 
                                                                    <StackPanel Grid.Row="2" VerticalAlignment="Stretch"
                                                                        <Grid> 
                                                                            <Grid.ColumnDefinitions> 
                                                                                <ColumnDefinition /> 
                                                                                <ColumnDefinition /> 
                                                                            </Grid.ColumnDefinitions> 
                                                                            <TextBlock Text="Category Group" Grid.Column="0" Foreground="white" Margin="0,0,5,0"/> 
                                                                            <ComboBox Grid.Column="1" Margin="0,0,5,0" x:Name="cmbCategoryGroup" /> 
                                                                        </Grid> 
                                                                    </StackPanel> 
                                                                    <StackPanel Grid.Row="3" VerticalAlignment="Stretch"
                                                                        <Grid> 
                                                                            <Grid.ColumnDefinitions> 
                                                                                <ColumnDefinition /> 
                                                                                <ColumnDefinition /> 
                                                                            </Grid.ColumnDefinitions> 
                                                                            <TextBlock Text="Category of Sales Item" Grid.Column="0" Foreground="white" Margin="0,0,5,0"/> 
                                                                            <ComboBox Grid.Column="1" Margin="0,0,5,0" x:Name="cmbCategory"/> 
                                                                        </Grid> 
                                                                    </StackPanel> 
                                                                </Grid> 
                                                            </telerik:RadWrapPanel> 
                                                        </telerik:RadExpander.Content> 
                                                    </telerik:RadExpander> 
                                                </StackPanel> 
                                                <StackPanel Grid.Row="1" VerticalAlignment="Stretch"
                                                    <telerik:RadExpander IsExpanded="True" ExpandDirection="down" Name="RadExpanderPeriod" VerticalAlignment="Stretch"
                                                        <telerik:RadExpander.Header> 
                                                            <TextBlock Text="Period" Foreground="white" /> 
                                                        </telerik:RadExpander.Header> 
                                                        <telerik:RadExpander.Content> 
                                                            <telerik:RadWrapPanel IsAnimated="False" Orientation="Horizontal" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                                                                    <StackPanel Grid.Row="0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0,0,0,0"
                                                                        <Grid> 
                                                                            <Grid.ColumnDefinitions> 
                                                                                <ColumnDefinition Width="Auto" /> 
                                                                                <ColumnDefinition Width="Auto" /> 
                                                                                <ColumnDefinition Width="Auto"/> 
                                                                                <ColumnDefinition Width="*"/> 
                                                                            </Grid.ColumnDefinitions> 
                                                                            <Grid.RowDefinitions> 
                                                                                <RowDefinition /> 
                                                                                <RowDefinition /> 
                                                                                <RowDefinition /> 
                                                                                <RowDefinition /> 
                                                                                <RowDefinition /> 
                                                                            </Grid.RowDefinitions> 
                                                                            <RadioButton x:Name="rbtPeriodDates" Grid.Column="0" Margin="0,0,5,0"/> 
                                                                            <input:RadDatePicker x:Name="dtePeriodFrom" HorizontalAlignment="Left" Culture="en-US" Grid.Column="1" Grid.Row="0" Margin="0,0,5,0 "/> 
                                                                            <TextBlock Text="-" Foreground="White" Grid.Column="2" Margin="0,0,5,0" /> 
                                                                            <input:RadDatePicker x:Name="dtePeriodTo" HorizontalAlignment="Left" Culture="en-US" Grid.Column="3" Grid.Row="0" Margin="0,0,5,0" /> 
                                                                            <RadioButton x:Name="rbtPeriodWeek" Grid.Column="0" Grid.Row="1" Margin="0,0,5,0"/> 
                                                                            <TextBlock Text="Since beginning of the current week" Foreground="White" Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="3" /> 
                                                                            <RadioButton x:Name="rbtPeriodMonth" Grid.Column="0" Grid.Row="2" Margin="0,0,5,0"/> 
                                                                            <TextBlock Text="Since beginning of the current month" Foreground="White" Grid.Column="1" Grid.Row="2" Grid.ColumnSpan="3" /> 
                                                                            <RadioButton x:Name="rbtPeriodTrimester" Grid.Column="0" Grid.Row="3" Margin="0,0,5,0"/> 
                                                                            <TextBlock Text="Since beginning of the current trimester" Foreground="White" Grid.Column="1" Grid.Row="3" Grid.ColumnSpan="3" /> 
                                                                            <RadioButton x:Name="rbtPeriodYear" Grid.Column="0" Grid.Row="4" Margin="0,0,5,0"/> 
                                                                            <TextBlock Text="Since beginning of the current year" Foreground="White" Grid.Column="1" Grid.Row="4" Grid.ColumnSpan="3" /> 
                                                                             
                                                                        </Grid> 
                                                                    </StackPanel> 
                                                            </telerik:RadWrapPanel> 
                                                        </telerik:RadExpander.Content> 
                                                    </telerik:RadExpander> 
                                                </StackPanel> 
                                                <StackPanel Grid.Row="2" VerticalAlignment="Stretch"
                                                    <telerik:RadExpander IsExpanded="True" ExpandDirection="down" Name="RadExpanderDay" VerticalAlignment="Stretch"
                                                        <telerik:RadExpander.Header> 
                                                            <TextBlock Text="Period of the day" Foreground="white" /> 
                                                        </telerik:RadExpander.Header> 
                                                        <telerik:RadExpander.Content> 
                                                            <telerik:RadWrapPanel IsAnimated="False" Orientation="Horizontal" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                                                                <StackPanel Grid.Row="0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0,0,0,0"
                                                                    <Grid> 
                                                                        <Grid.ColumnDefinitions> 
                                                                            <ColumnDefinition Width="Auto" /> 
                                                                            <ColumnDefinition Width="Auto" /> 
                                                                            <ColumnDefinition Width="Auto"/> 
                                                                            <ColumnDefinition Width="*"/> 
                                                                        </Grid.ColumnDefinitions> 
                                                                        <Grid.RowDefinitions> 
                                                                            <RowDefinition /> 
                                                                            <RowDefinition /> 
                                                                            <RowDefinition /> 
                                                                            <RowDefinition /> 
                                                                            <RowDefinition /> 
                                                                        </Grid.RowDefinitions> 
                                                                        <RadioButton x:Name="rbtPeriodTime" Grid.Column="0" Margin="0,0,5,0"/> 
                                                                        <input:RadTimePicker x:Name="timePeriodFrom" Grid.Column="1" Margin="0,0,5,0" /> 
                                                                        <TextBlock Text="-" Foreground="White" Grid.Column="2" Margin="0,0,5,0" /> 
                                                                        <input:RadTimePicker x:Name="timePeriodTo" Grid.Column="3" Margin="0,0,5,0" /> 
                                                                        <RadioButton x:Name="rbtPeriodBreakfast" Grid.Column="0" Grid.Row="1" Margin="0,0,5,0"/> 
                                                                        <TextBlock Text="Breakfast" Foreground="White" Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="3" /> 
                                                                        <RadioButton x:Name="rbtPeriodLunch" Grid.Column="0" Grid.Row="2" Margin="0,0,5,0"/> 
                                                                        <TextBlock Text="Lunch" Foreground="White" Grid.Column="1" Grid.Row="2" Grid.ColumnSpan="3" /> 
                                                                        <RadioButton x:Name="rbtPeriodDinner" Grid.Column="0" Grid.Row="3" Margin="0,0,5,0"/> 
                                                                        <TextBlock Text="Dinner" Foreground="White" Grid.Column="1" Grid.Row="3" Grid.ColumnSpan="3" /> 
                                                                        <RadioButton x:Name="rbtPeriodLateNight" Grid.Column="0" Grid.Row="4" Margin="0,0,5,0"/> 
                                                                        <TextBlock Text="Late Night" Foreground="White" Grid.Column="1" Grid.Row="4" Grid.ColumnSpan="3" /> 
     
                                                                    </Grid> 
                                                                </StackPanel> 
                                                            </telerik:RadWrapPanel> 
                                                        </telerik:RadExpander.Content> 
                                                    </telerik:RadExpander> 
                                                </StackPanel> 
                                                <StackPanel Grid.Row="3" VerticalAlignment="Stretch"
                                                    <telerik:RadExpander IsExpanded="True" ExpandDirection="down" Name="RadExpanderTerminal" VerticalAlignment="Stretch"
                                                        <telerik:RadExpander.Header> 
                                                            <TextBlock Text="Terminal" Foreground="white" /> 
                                                        </telerik:RadExpander.Header> 
                                                        <telerik:RadExpander.Content> 
                                                            <telerik:RadWrapPanel IsAnimated="False" Orientation="Horizontal" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                                                                <StackPanel Grid.Row="0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0,0,0,0"
                                                                    <Grid> 
                                                                        <Grid.RowDefinitions> 
                                                                            <RowDefinition /> 
                                                                            <RowDefinition /> 
                                                                        </Grid.RowDefinitions> 
                                                                        <Grid.ColumnDefinitions> 
                                                                            <ColumnDefinition /> 
                                                                        </Grid.ColumnDefinitions> 
                                                                        <StackPanel Grid.Row="0" VerticalAlignment="Stretch"
                                                                            <Grid VerticalAlignment="Stretch"
                                                                                <Grid.ColumnDefinitions> 
                                                                                    <ColumnDefinition Width="20" /> 
                                                                                    <ColumnDefinition /> 
                                                                                </Grid.ColumnDefinitions> 
                                                                                <Grid.RowDefinitions> 
                                                                                    <RowDefinition /> 
                                                                                </Grid.RowDefinitions> 
                                                                                <CheckBox x:Name="chkTerminalAll" Grid.Column="0" /> 
                                                                                <TextBlock Text="All" Foreground="White" Grid.Column="1"/> 
                                                                            </Grid> 
                                                                        </StackPanel> 
                                                                        <StackPanel Grid.Row="1" VerticalAlignment="Stretch"
                                                                            <Grid VerticalAlignment="Stretch"
                                                                                <Grid.ColumnDefinitions> 
                                                                                    <ColumnDefinition /> 
                                                                                    <ColumnDefinition /> 
                                                                                </Grid.ColumnDefinitions> 
                                                                                <Grid.RowDefinitions> 
                                                                                    <RowDefinition /> 
                                                                                </Grid.RowDefinitions> 
                                                                                <TextBlock Text="Select a particular terminal" Grid.Column="0" Foreground="white" Margin="0,0,5,0" /> 
                                                                                <ComboBox Grid.Column="1" x:Name="cmbTerminal" Margin="0,0,5,0" VerticalAlignment="Stretch" /> 
                                                                            </Grid> 
                                                                        </StackPanel> 
                                                                    </Grid> 
                                                                </StackPanel> 
                                                            </telerik:RadWrapPanel> 
                                                        </telerik:RadExpander.Content> 
                                                    </telerik:RadExpander> 
                                                </StackPanel> 
                                                <StackPanel Grid.Row="4" VerticalAlignment="Stretch"
                                                    <telerik:RadExpander IsExpanded="True" ExpandDirection="down" Name="RadExpanderSalesPerson" VerticalAlignment="Stretch"
                                                        <telerik:RadExpander.Header> 
                                                            <TextBlock Text="Sales Person" Foreground="white" /> 
                                                        </telerik:RadExpander.Header> 
                                                        <telerik:RadExpander.Content> 
                                                            <telerik:RadWrapPanel IsAnimated="False" Orientation="Horizontal" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                                                                <StackPanel Grid.Row="0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0,0,0,0"
                                                                    <Grid> 
                                                                        <Grid.RowDefinitions> 
                                                                            <RowDefinition /> 
                                                                            <RowDefinition /> 
                                                                        </Grid.RowDefinitions> 
                                                                        <Grid.ColumnDefinitions> 
                                                                            <ColumnDefinition /> 
                                                                        </Grid.ColumnDefinitions> 
                                                                        <StackPanel Grid.Row="0" VerticalAlignment="Stretch"
                                                                            <Grid> 
                                                                                <Grid.ColumnDefinitions> 
                                                                                    <ColumnDefinition Width="20" /> 
                                                                                    <ColumnDefinition /> 
                                                                                </Grid.ColumnDefinitions> 
                                                                                <CheckBox x:Name="chkSalesPersonAll" Grid.Column="0" /> 
                                                                                <TextBlock Text="All" Foreground="White" Grid.Column="1"/> 
                                                                            </Grid> 
                                                                        </StackPanel> 
                                                                        <StackPanel Grid.Row="1" VerticalAlignment="Stretch"
                                                                            <Grid VerticalAlignment="Stretch" Height="Auto"
                                                                                <Grid.ColumnDefinitions> 
                                                                                    <ColumnDefinition /> 
                                                                                    <ColumnDefinition /> 
                                                                                </Grid.ColumnDefinitions> 
                                                                                <Grid.RowDefinitions> 
                                                                                    <RowDefinition Height="Auto" /> 
                                                                                </Grid.RowDefinitions> 
                                                                                <TextBlock Text="Select a particular sales person" Foreground="white"  Margin="0,0,5,0"  /> 
                                                                                <ComboBox Grid.Column="1" x:Name="cmbSalesPerson" Margin="0,0,5,0" VerticalAlignment="Stretch"  /> 
                                                                            </Grid> 
                                                                        </StackPanel> 
                                                                    </Grid> 
                                                                </StackPanel> 
                                                            </telerik:RadWrapPanel> 
                                                        </telerik:RadExpander.Content> 
                                                    </telerik:RadExpander> 
                                                </StackPanel> 
                                            </Grid> 
                                            </telerik:RadWrapPanel> 
                                    </telerik:RadExpander.Content> 
                                </telerik:RadExpander> 
                            </StackPanel> 
                        </Border> 

    The Terminal and SalesPerson combobox generates this error:

    Message: Unhandled Error in Silverlight Application
    Code: 4004    
    Category: ManagedRuntimeError       
    Message: System.ArgumentException: Value does not fall within the expected range.
       at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
       at MS.Internal.XcpImports.UIElement_Measure(UIElement element, Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.ScrollContentPresenter.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)    

    Thanks
  2. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 26 Apr 2010 Link to this post

    Hi cielo,

    I cannot see a RadComboBox instance in the provided XAML. Could you please, check if you pasted the rigtht code? In addition, a sample application that could be used to observe the problem would be really helpful.

    Sincerely yours,
    Valeri Hristov
    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.
  3. DevCraft banner
  4. cielo valdoz
    cielo valdoz avatar
    33 posts
    Member since:
    Dec 2009

    Posted 26 Apr 2010 Link to this post

    Hi,

    I didn't use RadComboBox, its silverlight control. Anyway I upgraded to Silverlight 4 and Q1 2010 SP1 and it works great.
    Thanks
Back to Top