Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
200
null reference exception : at Infragistics.Controls.Editors.Primitives.SpecializedTextBox.ScrollToRightEnd() at Infragistics.Controls.Editors.ComboEditorBase`2.<EnsureCaretPositionOnGotFocus>b__10()
posted

I'm getting this exception when I try to instantiate an instance of a control that contains this template in a XamDockManager tab but not when it's just part of a normal window:

            <DataTemplate x:Key="CountryAndMarketsTemplate">
                <Grid HorizontalAlignment="Stretch"  MinWidth="200">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <Grid HorizontalAlignment="Stretch">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Image Source="{Binding Country, Converter={StaticResource flagsConverter}}" 
                                   IsEnabled="False"/>
                        <TextBlock Text="{Binding Name}"
                                   IsEnabled="False"  
                                   Grid.Column="1"/>
                    </Grid>
                    <ig:XamMenu ItemsSource="{Binding Path=Exchanges}" 
                                Grid.Row="1"
                                Grid.ColumnSpan="2"
                                MenuOrientation="Vertical"
                                ExpandOnHover="True"
                                HorizontalAlignment="Stretch"
                                HorizontalContentAlignment="Stretch"
                                Background="Transparent"
                                Foreground="{DynamicResource EditForeground}"
                                MinWidth="200">
                        <ig:XamMenu.HierarchicalItemTemplate>
                            <ig:HierarchicalDataTemplate  ItemsSource="{Binding Path=Markets}" >
                                <DataTemplate DataType="{x:Type viewModels:ExchangeTreeViewModel}">
                                    <TextBlock Text="{Binding Name}" 
                                               HorizontalAlignment="Stretch"
                                               IsEnabled="False"/>
                                </DataTemplate>
                                <ig:HierarchicalDataTemplate.ItemTemplate>
                                    <DataTemplate DataType="{x:Type viewModels:MarketTreeViewModel}">
                                        <Grid PreviewMouseLeftButtonDown="StackPanel_PreviewMouseLeftButtonUp" 
                                              HorizontalAlignment="Stretch">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="Auto"/>
                                                <ColumnDefinition Width="Auto"/>
                                                <ColumnDefinition Width="Auto"/>
                                                <ColumnDefinition Width="*"/>
                                            </Grid.ColumnDefinitions>
                                            <TextBlock Text="{Binding Name}"/>
                                            <TextBlock Text=" (" Grid.Column="1"/>
                                            <TextBlock Text="{Binding Count}" Grid.Column="2"/>
                                            <TextBlock Text=")" Grid.Column="3"/>
                                        </Grid>
                                    </DataTemplate>
                                </ig:HierarchicalDataTemplate.ItemTemplate>
                            </ig:HierarchicalDataTemplate>
                        </ig:XamMenu.HierarchicalItemTemplate>
                    </ig:XamMenu>
                </Grid>
            </DataTemplate>

And the control itself:

        <ig:XamComboEditor x:Name="cmboLists"
                           ItemsSource="{Binding Path=Lists}" 
                           EmptyText="Select a list..."
                           Background="{DynamicResource EditBackground}"
                           EditAreaBackground="{DynamicResource EditBackground}"
                           BorderBrush="{DynamicResource EditBackground}"
                           Foreground="{DynamicResource EditForeground}"                                  
                           Visibility="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:MarketsByCountryControl}}, Path=DataContext.ShowDropDown, Converter={StaticResource boolToVisibility}}"
                           AllowDropDownResizing="False"
                           ItemTemplate="{StaticResource CountryAndMarketsTemplate}"
                           VerticalAlignment="Center"         
                           MinWidth="250"
                           Margin="5,0,0,0">
        </ig:XamComboEditor>
when I expand the dropdown I also get binding expression errors that indicates that it's trying to bind first level using the bottom level template.
Here's the stack trace I'm getting:

at Infragistics.Controls.Editors.Primitives.SpecializedTextBox.ScrollToRightEnd()
at Infragistics.Controls.Editors.ComboEditorBase`2.<EnsureCaretPositionOnGotFocus>b__10()
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()