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

Value does not fall within the expected range

1 Answer 169 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
Louis Bouchard
Top achievements
Rank 1
Louis Bouchard asked on 01 Feb 2011, 02:09 AM
Hello,

I got a UserControl with nothing special :

        <telerik:RadTabControl Name="RadTabControlFiche"  Width="835"  VerticalAlignment="Top" HorizontalAlignment="Left"  DisplayMemberPath="Content" DropDownDisplayMode="Collapsed" ScrollMode="Viewport" Background="LightGray" BorderThickness="1" BorderBrush="Black" SelectionChanged="RadTabControlFicheSauvetage_SelectionChanged">
                <telerik:RadTabItem Name="RadTabItemInformations" Padding="9 3" DropDownContent="{Binding Source={StaticResource LocalisationFicheSauvetage}, Path=RadTabItemHeaderInformationsSurveillant}" >
                <telerik:RadTabItem.Header>
                        <StackPanel Orientation="Horizontal" IsHitTestVisible="False">
                            <Image Source="../images/information.png" Height="25" Width="25" />
                            <toolkit:Separator Style="{StaticResource SeparatorMenuStyle}" Width="8"/>                            
                            <TextBlock Text="{Binding Source={StaticResource LocalisationFicheSauvetage}, Path=RadTabItemHeaderInformationsSurveillant}"  FontSize="11"  FontWeight="Normal"/>
                        </StackPanel>
                 </telerik:RadTabItem.Header>
                <telerik:RadTabItem.Content>
                        <StackPanel Orientation="Vertical">
                            <Border Margin="2" Grid.Row="0" Grid.RowSpan="2" BorderBrush="DarkGray" BorderThickness="1" CornerRadius="4" >
                                <Grid >
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition  Height="270" />
                                    </Grid.RowDefinitions>
                                    <telerik:RadRichTextBoxRibbonUI x:Name="RadRichTextBoxRibbonUIInformationsSurveillant" DataContext="{Binding Path=Commands, ElementName=richTextBoxInformationsSurveillant}" ApplicationName="{x:Null}"  ApplicationButtonVisibility="Collapsed">
                                        <telerik:RadRichTextBoxRibbonUI.QuickAccessToolBar>
                                            <telerik:QuickAccessToolBar>
                                                <telerik:RadRibbonButton x:Name="RadRibbonButtonSaveInformationsSurveillant" Click="RadRibbonButtonSaveInformationsSurveillant_Click" Size="Small" SmallImage="/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/save.png" Text="{Binding Source={StaticResource LocalisationUrgence}, Path=RadRibbonButtonTextSave}" />
                                                <telerik:RadRibbonButton telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=UndoCommand}" Size="Small" SmallImage="/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/undo.png" Text="{Binding Source={StaticResource LocalisationUrgence}, Path=RadRibbonButtonTextUndo}" />
                                                <telerik:RadRibbonButton telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=RedoCommand}" Size="Small" SmallImage="/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/redo.png" Text="{Binding Source={StaticResource LocalisationUrgence}, Path=RadRibbonButtonTextRedo}" />
                                            </telerik:QuickAccessToolBar>
                                        </telerik:RadRichTextBoxRibbonUI.QuickAccessToolBar>
  
                                        <!-- <telerik:RadRibbonTab Header="Home">-->
                                        <telerik:RadRibbonTab Header="{Binding Source={StaticResource LocalisationUrgence}, Path=RadRibbonTabHeader}">
...
                                        </telerik:RadRibbonTab>
                                    </telerik:RadRichTextBoxRibbonUI>
                                    <telerik:RadRichTextBox Grid.Row="1" x:Name="richTextBoxInformationsSurveillant" Loaded="richTextBoxInformationsSurveillant_Loaded" IsSpellCheckingEnabled="False"  IsSelectionMiniToolBarEnabled ="True" IsContextMenuEnabled="False" Unloaded="SelectionMiniToolBarHide"/>
                                </Grid>
                            </Border>
                            <Grid Grid.Column="1" Grid.Row="1" Margin="5 5 5 2" Visibility="Collapsed">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="24" />
                                    <RowDefinition />
                                </Grid.RowDefinitions>
                                <Border CornerRadius="5 5 0 0" Background="{StaticResource HeaderContentBackgroundBrush}" BorderBrush="DarkGray" BorderThickness="1 1 1 0">
                                    <TextBlock Margin="6 0" VerticalAlignment="Center">HTML Binding</TextBlock>
                                </Border>
                                <Border Margin="0" Grid.Row="1" Grid.RowSpan="3" BorderBrush="DarkGray" BorderThickness="1 0 1 1" CornerRadius="0 0 5 5" >
                                    <TextBox x:Name="TextBoxInformationsSurveillantHTML" Margin="0" Grid.Row="3" Grid.Column="1" IsReadOnly="True" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto"
                                      Text="{Binding Source={StaticResource htmlDataProviderInformationsSurveillant}, Path=Html}" BorderThickness="0"  Unloaded="TextBoxInformationsSurveillantHTML_Unloaded" />
                                </Border>
                            </Grid>
                        </StackPanel>
                </telerik:RadTabItem.Content>
            </telerik:RadTabItem>
...

And SOMETIME, I have this error :

Erreur d'exécution Microsoft JScript: Unhandled Error in Silverlight Application
Code: 4004   
Category: ManagedRuntimeError      
Message: System.Windows.Markup.XamlParseException: Value does not fall within the expected range . [Line: 0 Position: 0] ---> System.ArgumentException: La valeur n'est pas comprise dans la plage attendue.
   à MS.Internal.XcpImports.CheckHResult(UInt32 hr)
   à MS.Internal.XcpImports.Collection_AddValue[T](PresentationFrameworkCollection`1 collection, CValue value)
   à MS.Internal.XcpImports.Collection_AddDependencyObject[T](PresentationFrameworkCollection`1 collection, DependencyObject value)
   à System.Windows.PresentationFrameworkCollection`1.AddDependencyObject(DependencyObject value)
   à System.Windows.Controls.UIElementCollection.AddInternal(UIElement value)
   à System.Windows.Controls.ItemsControl.AddVisualChild(Int32 containerIndex, DependencyObject container, Boolean needPrepareContainer)
   à System.Windows.Controls.ItemsControl.AddContainers()
   à System.Windows.Controls.ItemsControl.RecreateVisualChildren(IntPtr unmanagedObj)
   --- Fin de la trace de la pile d'exception interne ---
   à MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData)
   à MS.Internal.XcpImports.MethodEx(DependencyObject obj, String name)
   à MS.Internal.XcpImports.FrameworkElement_ApplyTemplate(FrameworkElement frameworkElement)
   à System.Windows.Controls.ScrollContentPresenter.HookupScrollingComponents()
   à System.Windows.Controls.ScrollContentPresenter.OnApplyTemplate()
   à System.Windows.FrameworkElement.OnApplyTemplate(IntPtr nativeTarget)  

Any clue?




1 Answer, 1 is accepted

Sort by
0
Kiril Stanoev
Telerik team
answered on 03 Feb 2011, 01:44 PM
Hi Louis,

From the information you've provided us with I wasn't able to determine the cause for your error. One possible reason for the issue you are experiencing is if something in your ViewModel is a UI element. However, I'll need more info to be better able to assist you.
I'm attaching a project with a stripped down version of the code you sent us. Please have a look at it and let me know if I am missing something.

Greetings,
Kiril Stanoev
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Tags
TabControl
Asked by
Louis Bouchard
Top achievements
Rank 1
Answers by
Kiril Stanoev
Telerik team
Share this question
or