silverlight error 4004 value does not fall within expected range

5 posts, 0 answers
  1. peter
    peter avatar
    37 posts
    Member since:
    Feb 2011

    Posted 26 Mar 2012 Link to this post

    Hi I have the following which should load up an edit or add dataform based on the button clicked;

    <StackPanel HorizontalAlignment="Right" VerticalAlignment="Top" Orientation="Horizontal">
        <Telerik:RadButton x:Name="RadButtonAdd" RenderTransformOrigin="0.5,0.5" Style="{StaticResource HeaderCircleButtonStyle}" Margin="0,0,40,0" Tag="ADD"
              Click="RadButtonAdd_Click"   Command="Telerik:RadDataFormCommands.AddNew" CommandTarget="{Binding ElementName=dataForm}">
            <Telerik:RadButton.RenderTransform>
                <CompositeTransform TranslateY="-21"/>
            </Telerik:RadButton.RenderTransform>
        </Telerik:RadButton>
        <Telerik:RadButton x:Name="RadButtonEdit" RenderTransformOrigin="0.5,0.5" Style="{StaticResource HeaderCircleButtonStyle}" 
               Click="RadButtonEdit_Click"   Command="Telerik:RadDataFormCommands.BeginEdit" CommandTarget="{Binding ElementName=dataForm}" Tag="EDIT">
            <Telerik:RadButton.RenderTransform>
                <CompositeTransform TranslateY="-21"/>
            </Telerik:RadButton.RenderTransform>
        </Telerik:RadButton>
    </StackPanel>

    The problem is whenever I click the buttons i get an error "silverlight error 4004 value does not fall within expected range". Can someone please let me know what I am doing wrong, and why this error appears. Thanks
  2. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1127 posts

    Posted 26 Mar 2012 Link to this post

    Hi,

    Would you please open a support ticket, sending us a runnable project that reproduces the described issue? I fear that it will be impossible for us to pinpoint the problem, only having a short XAML snippet.

    All the best,
    Ivan Ivanov
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. DevCraft banner
  4. peter
    peter avatar
    37 posts
    Member since:
    Feb 2011

    Posted 26 Mar 2012 Link to this post

    Hi thanks for your prompt reply, due to the nature of work, i wont be able to send a solution, however this is what the whole xaml looks like;

    <navigation:Page x:Class="CLS.StaticData1.Views.StaticData.Events" 
               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
               xmlns:Telerik="http://schemas.telerik.com/2008/xaml/presentation"
               xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.SL4"
               xmlns:vm="clr-namespace:CLSServices.StaticDataProcessing.ViewModels"
               xmlns:local="clr-namespace:CLSServices.StaticDataProcessing.Utilities"
               xmlns:System="clr-namespace:System;assembly=mscorlib"
               xmlns:ViewControl="clr-namespace:CLS.StaticData1.Views.StaticData"
               mc:Ignorable="d"   HorizontalContentAlignment="Stretch"
               d:DesignWidth="640" d:DesignHeight="480"
               xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
               xmlns:ClassLibrary="clr-namespace:CLSServices.SL.Apps.ClassLibrary;assembly=CLSServices.SL.Apps.ClassLibrary"
               Title="Events Page">
        <Grid x:Name="LayoutRoot" Margin="0,180,0,3" VerticalAlignment="Stretch">
            <Grid.Resources>
                <vm:StaticDataEventViewModel x:Key="vm"></vm:StaticDataEventViewModel>
                <ClassLibrary:ConvertBoolToYesNo x:Key="ConvertBoolToYesNo"></ClassLibrary:ConvertBoolToYesNo>
            </Grid.Resources>
      
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="0"/>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition Width="0"/>
            </Grid.ColumnDefinitions>
      
            <Rectangle Grid.ColumnSpan="17" Grid.Column="1" Fill="{StaticResource AccentBrush}" Height="30" VerticalAlignment="Top" StrokeThickness="0" Margin="0,0,-16,0"/>
      
            <Grid x:Name="EventListGrid" Grid.Column="1"  Grid.ColumnSpan="10"  Margin="0,10,8,0">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <Telerik:RadGridView x:Name="staticDataRadGrid" IsSynchronizedWithCurrentItem="True"
                                 Style="{StaticResource CustomRadGridViewStyle}"
                                 SelectedItem="{Binding Path=EventCollectionDTO, Source={StaticResource vm}, Mode=TwoWay}"
                                 MinHeight="700" 
                                 ColumnWidth="*" Grid.Row="1" 
                                 AutoGenerateColumns="False" 
                                 ItemsSource="{Binding PagedSource, ElementName=_radDataPager}" 
                                 CanUserFreezeColumns="False" 
                                 VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" Grid.ColumnSpan="10"
                                 ShowGroupPanel="False">
                        <i:Interaction.Behaviors>
                            <ClassLibrary:EmptyDataTemplateBehavior>
                                <ClassLibrary:EmptyDataTemplateBehavior.EmptyDataTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="No results found!" Foreground="Black" FontSize="20"  HorizontalAlignment="Center"  VerticalAlignment="Center" Visibility="{Binding NoResultsVisibility,Source={StaticResource vm}}"  />
                                    </DataTemplate>
                                </ClassLibrary:EmptyDataTemplateBehavior.EmptyDataTemplate>
                            </ClassLibrary:EmptyDataTemplateBehavior>
                        </i:Interaction.Behaviors>
                        <Telerik:RadGridView.Columns>
                            <Telerik:GridViewDataColumn Header="Entity Name" TextWrapping="Wrap"  IsReadOnly="True" DataMemberBinding="{Binding EventHeader.EntityName}"    IsGroupable="False" Width="2*"/>
                            <Telerik:GridViewDataColumn Header="Entity Mail Address" TextWrapping="Wrap" IsReadOnly="True" DataMemberBinding="{Binding EventHeader.EmailAddress}"   IsGroupable="False" Width="3*"/>
                            <Telerik:GridViewDataColumn Header="Event Type" TextWrapping="Wrap"  IsReadOnly="True" DataMemberBinding="{Binding EventHeader.EventTypeName}" IsGroupable="False" Width="2*"/>
                            <Telerik:GridViewDataColumn Header="Initiated By" TextWrapping="Wrap"  IsReadOnly="True" DataMemberBinding="{Binding EventHeader.InitiatedBy}" IsGroupable="False" Width="2*"/>
                            <Telerik:GridViewDataColumn Header="Date Initiated" TextWrapping="Wrap"  IsReadOnly="True" DataMemberBinding="{Binding EventHeader.SentDate,StringFormat='{}{0:dd/MM/yyyy}'}" IsGroupable="False" Width="2*"/>
                            <Telerik:GridViewDataColumn Header="Environment" TextWrapping="Wrap"  IsReadOnly="True" DataMemberBinding="{Binding EventHeader.EnvironmentName}" IsGroupable="False" Width="2*"/>
                            <Telerik:GridViewDataColumn Header="Current State" TextWrapping="Wrap"  IsReadOnly="True" DataMemberBinding="{Binding EventHeader.EventState}" IsGroupable="False" Width="2*"/>
                            <Telerik:GridViewColumn Header="Actions"  Width="3*">
                                <Telerik:GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <StackPanel Orientation="Horizontal">
                                            <Telerik:RadButton  x:Name="_buttonMail"   ToolTipService.ToolTip="Send Email">
                                                <Image ToolTipService.ToolTip="Send Email"   Source="/CLSServices.SL.Apps.Styles;component/Icons_Medium/mail.png"></Image>
                                                <i:Interaction.Triggers>
                                                    <i:EventTrigger EventName="Click">
                                                        <cmd:EventToCommand Command="{Binding ClickCommand, Source={StaticResource vm}}" CommandParameter="{Binding}"></cmd:EventToCommand>
                                                    </i:EventTrigger>
                                                </i:Interaction.Triggers>
                                            </Telerik:RadButton>
                                            <Border Padding="7"></Border>
      
                                            <Telerik:RadButton  x:Name="_buttonAccept"   ToolTipService.ToolTip="Accept">
                                                <Image ToolTipService.ToolTip="Accept"   Source="/CLSServices.SL.Apps.Styles;component/Icons_Medium/accept.png"></Image>
                                                <i:Interaction.Triggers>
                                                    <i:EventTrigger EventName="Click">
                                                        <cmd:EventToCommand Command="{Binding CanVerifyCommand, Source={StaticResource vm}}" CommandParameter="{Binding}"></cmd:EventToCommand>
                                                    </i:EventTrigger>
                                                </i:Interaction.Triggers>
                                            </Telerik:RadButton>
                                            <Border Padding="7"></Border>
                                            <Telerik:RadButton x:Name="_buttonReject"  Command="{Binding ClickCommand, Source={StaticResource vm}}" CommandParameter="{Binding Tag, ElementName=_buttonEdit}" Tag="showmembereditdetailformwindow"  ToolTipService.ToolTip="Reject">
                                                <Image   Source="/CLSServices.SL.Apps.Styles;component/Icons_Medium/reject.png"></Image>
                                            </Telerik:RadButton>
      
                                        </StackPanel>
                                    </DataTemplate>
                                </Telerik:GridViewColumn.CellTemplate>
                            </Telerik:GridViewColumn>
                        </Telerik:RadGridView.Columns>
                        <Telerik:RadGridView.ChildTableDefinitions>
                            <Telerik:GridViewTableDefinition >
                                <Telerik:GridViewTableDefinition.Relation>
                                    <Telerik:TableRelation IsSelfReference="False">
                                        <Telerik:TableRelation.FieldNames>
                                            <Telerik:FieldDescriptorNamePair ParentFieldDescriptorName="ID" ChildFieldDescriptorName="EventID"/>
                                        </Telerik:TableRelation.FieldNames>
                                    </Telerik:TableRelation>
                                </Telerik:GridViewTableDefinition.Relation>
                            </Telerik:GridViewTableDefinition>
                        </Telerik:RadGridView.ChildTableDefinitions>
                        <Telerik:RadGridView.HierarchyChildTemplate>
                            <DataTemplate>
                                <Telerik:RadGridView x:Name="staticDataEventDetailRadGrid" MinWidth="750" MaxWidth="830" VerticalAlignment="Stretch"   Style="{StaticResource CustomRadGridViewStyle}"  CanUserFreezeColumns="False" AutoExpandGroups="True"   AutoGenerateColumns="False" ItemsSource="{Binding EventDetails}"   ShowGroupPanel="False" IsReadOnly="True">
                                    <Telerik:RadGridView.Columns>
                                        <Telerik:GridViewDataColumn TextWrapping="Wrap"  DataMemberBinding="{Binding EventProcess}" Header="Process" IsGroupable="False" Width="3*"/>
                                        <Telerik:GridViewDataColumn TextWrapping="Wrap"  DataMemberBinding="{Binding FormName}" Header="Form Name" IsGroupable="False"  Width="3*" />
                                        <Telerik:GridViewDataColumn TextWrapping="Wrap"  DataMemberBinding="{Binding FormState}" Header="State" IsGroupable="False" Width="2*" />
                                        <Telerik:GridViewDataColumn TextWrapping="Wrap"  DataMemberBinding="{Binding DueDate,StringFormat='{}{0:dd/MM/yyyy}'}"   Header="Due Date" IsGroupable="False" Width="2*" />
                                        <Telerik:GridViewDataColumn TextWrapping="Wrap"  DataMemberBinding="{Binding ReceivedDate,StringFormat='{}{0:dd/MM/yyyy}'}" Header="Received Date" IsGroupable="False" Width="3*" />
                                        <Telerik:GridViewDataColumn TextWrapping="Wrap"  DataMemberBinding="{Binding ReminderDate,StringFormat='{}{0:dd/MM/yyyy}'}" Header="Reminder Date" IsGroupable="False" Width="3*" />
                                        <Telerik:GridViewDataColumn DataMemberBinding="{Binding bMT299Received, Converter={StaticResource ConvertBoolToYesNo}}" Header="MT299 Recieved" IsGroupable="False" Width="3*" />
                                        <Telerik:GridViewColumn Header="Actions"  Width="3*">
                                            <Telerik:GridViewColumn.CellTemplate>
                                                <DataTemplate>
                                                    <StackPanel Orientation="Horizontal">
                                                        <Telerik:RadButton  x:Name="_buttonAccept"   ToolTipService.ToolTip="Accept">
                                                            <Image ToolTipService.ToolTip="Accept"   Source="/CLSServices.SL.Apps.Styles;component/Icons_Medium/accept.png"></Image>
                                                            <i:Interaction.Triggers>
                                                                <i:EventTrigger EventName="Click">
                                                                    <cmd:EventToCommand Command="{Binding CanVerifyCommand, Source={StaticResource vm}}" CommandParameter="{Binding}"></cmd:EventToCommand>
                                                                </i:EventTrigger>
                                                            </i:Interaction.Triggers>
                                                        </Telerik:RadButton>
                                                        <Border Padding="7"></Border>
                                                        <Telerik:RadButton x:Name="_buttonReject"  Command="{Binding ClickCommand, Source={StaticResource vm}}" CommandParameter="{Binding Tag, ElementName=_buttonEdit}" Tag="showmembereditdetailformwindow"  ToolTipService.ToolTip="Reject">
                                                            <Image   Source="/CLSServices.SL.Apps.Styles;component/Icons_Medium/reject.png"></Image>
                                                        </Telerik:RadButton>
      
                                                    </StackPanel>
                                                </DataTemplate>
                                            </Telerik:GridViewColumn.CellTemplate>
                                        </Telerik:GridViewColumn>
                                    </Telerik:RadGridView.Columns>
                                </Telerik:RadGridView>
                            </DataTemplate>
                        </Telerik:RadGridView.HierarchyChildTemplate>
                    </Telerik:RadGridView>
                    <Telerik:RadDataPager  Grid.Row="2"
                                       x:Name="_radDataPager"
                                       PageSize="10"
                                       DisplayMode="All"
                                       VerticalAlignment="Bottom"
                                       IsTotalItemCountFixed="True" Source="{Binding BindsDirectlyToSource=True, Path=EventCollectionDTOs,Source={StaticResource vm}, TargetNullValue=''}" Height="28"/>
      
                    <Grid Height="30" VerticalAlignment="Top">
                        <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="STATIC DATA EVENTS" VerticalAlignment="Center" FontFamily="Segoe UI Semibold" Foreground="{StaticResource MainBrush}"/>
      
                    </Grid>
                </Grid>
            <Grid x:Name="EventDetailGrid"  Grid.Column="11"  Grid.ColumnSpan="6" Margin="0,10,8,0">
                <Telerik:RadDataForm x:Name="dataForm" 
                                 CurrentItem="{Binding EventCollectionDTO, Source={StaticResource vm}}"
                                 ItemsSource="{Binding EventCollectionDTOs, Source={StaticResource vm}}"
                                 CommandButtonsVisibility="Cancel,Commit"  
                                 CurrentItemChanged="OnDataFormCurrentItemChanged"
                                 AutoGenerateFields="False" Style="{StaticResource CustomRadDataFormStyle}"
                                 VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" Margin="0,29,0,7">
                    <Telerik:RadDataForm.ReadOnlyTemplate>
                        <DataTemplate x:Name="ReadOnlyDataTemplate">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="*"/>
                                    <RowDefinition Height="Auto"/>
                                </Grid.RowDefinitions>
      
                                <StackPanel Margin="105,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Bottom">
                                    <TextBlock x:Name="txtEventTypeName" Text="{Binding EventHeader.EventTypeName}" FontFamily="Segoe UI Light" FontSize="32" Foreground="{StaticResource AccentBrush}" />
                                    <TextBlock  x:Name="txtEntityName"  Text="{Binding EventHeader.EntityName}" FontFamily="Segoe UI Light" FontSize="32" Foreground="{StaticResource AccentBrush}" />
      
                                </StackPanel>
                            </Grid>
                        </DataTemplate>
                    </Telerik:RadDataForm.ReadOnlyTemplate>
                    <Telerik:RadDataForm.EditTemplate>
                        <DataTemplate x:Name="EditDataTemplate">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="*"/>
                                    <RowDefinition Height="Auto"/>
                                </Grid.RowDefinitions>
      
                                <StackPanel Margin="105,0,0,0" VerticalAlignment="Bottom">
      
                                    <Telerik:DataFormDataField x:Name="eventtypeedit" DataMemberBinding="{Binding EventHeader.EventTypeName, Mode=TwoWay, ValidatesOnNotifyDataErrors=False}" Foreground="{StaticResource AccentBrush}" FontFamily="Segoe UI Light" FontSize="28" >
                                    </Telerik:DataFormDataField>
                                </StackPanel>
                            </Grid>
                        </DataTemplate>
                    </Telerik:RadDataForm.EditTemplate>
      
                </Telerik:RadDataForm>
      
                <StackPanel HorizontalAlignment="Right" VerticalAlignment="Top" Orientation="Horizontal">
                    <Telerik:RadButton x:Name="RadButtonAdd" RenderTransformOrigin="0.5,0.5" Style="{StaticResource HeaderCircleButtonStyle}" Margin="0,0,40,0" Tag="ADD"
                          Click="RadButtonAdd_Click"   Command="Telerik:RadDataFormCommands.AddNew" CommandTarget="{Binding ElementName=dataForm}">
                        <Telerik:RadButton.RenderTransform>
                            <CompositeTransform TranslateY="-21"/>
                        </Telerik:RadButton.RenderTransform>
                    </Telerik:RadButton>
                    <Telerik:RadButton x:Name="RadButtonEdit" RenderTransformOrigin="0.5,0.5" Style="{StaticResource HeaderCircleButtonStyle}" 
                           Click="RadButtonEdit_Click"   Command="Telerik:RadDataFormCommands.BeginEdit" CommandTarget="{Binding ElementName=dataForm}" Tag="EDIT">
                        <Telerik:RadButton.RenderTransform>
                            <CompositeTransform TranslateY="-21"/>
                        </Telerik:RadButton.RenderTransform>
                    </Telerik:RadButton>
                </StackPanel>
      
            </Grid>
      
        </Grid>
    </navigation:Page>

    There is no code behind due to the fact I am using MVVM, well nothing which would affect it. Let me know if this is sufficient. Thanks
  5. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1127 posts

    Posted 26 Mar 2012 Link to this post

    Hello Peter,

    RadDataFormCommands have internal logic and the error you have reported looks like an ArgumentException. I have looked through the XAML and I have not find anything suspicious, so that I strongly believe that the issue's source is not there. You are referencing multiple thirdparty classes in your XAML, so that it would be impossible for us to create a runnable application without any additional help from you. Please, try to isolate this issue in a small project, or at least give us some guidelines how to reproduce it on our side.

    All the best,
    Ivan Ivanov
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  6. peter
    peter avatar
    37 posts
    Member since:
    Feb 2011

    Posted 29 Mar 2012 Link to this post

    Thanks for your suggestion, i ended up stripping out the styles, and it was one of the styles applied to it which was affecting it. Thanks
Back to Top
DevCraft banner