Windows Store Apps – ComboBox : Catastrophic failure

Damir Dobric Posts

Next talks:

 

    

Follow me on Twitter: #ddobric



 

 

Archives

If you read this post, you are probably frustrated and have been redirected by some search machine:)
The error you have sounds like:

Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))

If you are running in debugger, you will even get more information:

      #endif
#if DEBUG && !DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION
            UnhandledException += (sender, e) =>
            {
                if (global::System.Diagnostics.Debugger.IsAttached) global::System.Diagnostics.Debugger.Break();
            };
#endif
        }
    }
}

 

If you dig more into this error you will find more (nothing saying) details. Here is next example:
image

This error is cause by following XAML:

 

            <ComboBox Name="m_CmbSubProject" Grid.Column="3"     
                     Grid.ColumnSpan
="2" Grid.Row="4" Margin="10, 18"
                    
ItemsSource="{Binding SubProjectList}" 
                     DisplayMemberPath
="Name2" >
                <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal" >
                            <TextBlock Text="{Binding Name2}" Margin="2" />
                            <TextBlock Text="{Binding Name}" Margin="2" />
                        </StackPanel>
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>

 

The error is caused by setting of DisplayMemberPath. If the ItemTemplate is used, it is reasonable that this property has not sense. The only problem with this is that this property can easily be ignored by ComboBox team.
If there is behind this some deeper scientific reason, then one human understandable exception would be more than welcome. :)

Cheers.


Posted Aug 06 2013, 07:20 AM by Damir Dobric
developers.de is a .Net Community Blog powered by daenet GmbH.