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
640
Upgrading XamComboEditor from .NET advantage 13.1 to Ultimate 15.1:
posted

Hello,

We’re using a XamComboEditor in .NET advantage 13.1 and are upgrading to Ultimate 15.1.

The ComboEditor crashes our application after this upgrade.

 

We used to have a custom filter in our ComboEditor:

    <editors:XamComboEditor x:Name="comboEditor" AutoComplete="False" AllowFiltering="True"

                                            Style="{StaticResource OurStyle}"

                                           Width="180" Height="25" MaxHeight="25" MinHeight="25" Margin="15,0,0,0"

                                           ItemsSource="{Binding OutItems}"

                                           DisplayMemberPath="Name"

                                            SelectedItem="{Binding SelectedItem}" >

                                        <editors:XamComboEditor.ItemTemplate>

                                            <DataTemplate>

                                                <StackPanel Orientation="Horizontal" >

                                                    <TextBlock Text="{Binding Path=Name}" Margin="5" Foreground="{DynamicResource OurForeground}"/>

                                                </StackPanel>

                                            </DataTemplate>

                                        </editors:XamComboEditor.ItemTemplate>

                                        <editors:XamComboEditor.CustomItemsFilter>

                                            <editors:ItemsFilter>

                                                <editors:ItemsFilter.Conditions>

                                                    <infragistics:ComparisonCondition Operator="Contains" />

                                                </editors:ItemsFilter.Conditions>

                                            </editors:ItemsFilter>

                                        </editors:XamComboEditor.CustomItemsFilter>

                                    </editors:XamComboEditor>

 

This control does not compile in 15.1. because of the “CustomItemFilter” object.

I changed the CustomItemFilter to ItemFilters and here’s the new ComboEditor:

    <editors:XamComboEditor x:Name="comboEditor" AutoComplete="False" AllowFiltering="True"

                                            Style="{StaticResource OurStyle}"

                                           Width="180" Height="25" MaxHeight="25" MinHeight="25" Margin="15,0,0,0"

                                           ItemsSource="{Binding OutItems}"

                                           DisplayMemberPath="Name"

                                            SelectedItem="{Binding SelectedItem}" >

                                        <editors:XamComboEditor.ItemTemplate>

                                            <DataTemplate>

                                                <StackPanel Orientation="Horizontal" >

                                                    <TextBlock Text="{Binding Path=Name}" Margin="5" Foreground="{DynamicResource OurForeground}"/>

                                                </StackPanel>

                                            </DataTemplate>

                                        </editors:XamComboEditor.ItemTemplate>

                                        <editors:XamComboEditor.ItemFilters>

                                            <editors:ComboItemFilter>

                                                <editors:ComboItemFilter.Conditions>

                                                    <infragistics:ComparisonCondition Operator="Contains" />

                                                </editors:ComboItemFilter.Conditions>

                                            </editors:ComboItemFilter>

                                        </editors:XamComboEditor.ItemFilters>

                                </editors:XamComboEditor>

 

That’s working, but our style is now causing runtime errors.

I get a NullReferenceException with the following stack (Will provide the complete stack if needed)

on. System.NullReferenceException: Object reference not set to an instance of an object.

   at Infragistics.Controls.Editors.ComboEditorBase`2.UpdatePositionStates()

   at Infragistics.Controls.Editors.Primitives.ItemsPanelBase`2.MeasureOverride(Size availableSize)

   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)

   at System.Windows.UIElement.Measure(Size availableSize)

 

The source of the exception seems to be our MouseOver Visualstate (can provide the entire style if needed):

                                <VisualState x:Name="MouseOver">

                                    <Storyboard>

                                       <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Bd" Storyboard.TargetProperty="Fill">

                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ComboEditorItemHoverBackgroundFillBrush}"/>

                                        </ObjectAnimationUsingKeyFrames>

                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Bd" Storyboard.TargetProperty="Stroke">

                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ComboEditorItemHoverBackgroundFillBrush}"/>

                                        </ObjectAnimationUsingKeyFrames>

                                    </Storyboard>

                                </VisualState>

 

Is the change to the XAML object correct? Is there another object tag which is correct ?

If my change is correct, what may be causing the crash ?

 

Thanks.

Parents Reply Children