WpfThemesCollection icon indicating copy to clipboard operation
WpfThemesCollection copied to clipboard

XAML designer chokes on scrolling list boxes

Open devuxer opened this issue 9 years ago • 2 comments

List boxes have stopped working in the designer since upgrading to Visual Studio 2015.

The following exception occurs if the items in the list box exceed the height of the list box:

InvalidOperationException: 'Color(#FFFFFFFF)' is not a valid value for property 'Color'.
StackTrace
at System.Windows.DependencyObject.EvaluateExpression(EntryIndex entryIndex, DependencyProperty dp, Expression expr, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry newEntry)
at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
at System.Windows.Baml2006.WpfKnownMemberInvoker.SetValue(Object instance, Object value)
at MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(XamlMember member, Object obj, Object value)
at MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(Object inst, XamlMember property, Object value)
InnerException: None

If you uncomment the last ListBoxItem in this code, the designer will choke on it:

<ListBox Margin="0,10,0,0" Width="200" Height="241">
    <ListBoxItem Content="Afghanistan (AFG)" />
    <ListBoxItem Content="Åland Islands (ALA)" />
    <ListBoxItem Content="Albania (ALB)" />
    <ListBoxItem Content="Algeria (DZA)" />
    <ListBoxItem Content="American Samoa (ASM)" />
    <ListBoxItem Content="Andorra (AND)" />
    <ListBoxItem Content="Angola (AGO)" />
    <ListBoxItem Content="Anguilla (AIA)" />
    <ListBoxItem Content="Antarctica (ATA)" />
    <ListBoxItem Content="Antigua and Barbuda (ATG)" />
    <!--<ListBoxItem Content="Argentina (ARG)" />-->
</ListBox>

devuxer avatar Sep 08 '15 20:09 devuxer

Thank you for reporting this problem devuxer! I was able to reproduce it in my Microsoft Visual Studio Enterprise 2015 (14.0.23107.0). I included your sample code for ListBox in the ThemeBrowser to make it easier for others to see (https://github.com/StanislawSwierc/WpfThemesCollection/commit/71b640c76e0c97aa3913709ab1de3027557a7838). Not only did I see it for ListBox, but for other controls as well. This looks like a problem in the designer to me and I will try to escalate it to WPF Team.

So far I haven't found a workaround. I will update this issue when I get more information.

StanislawSwierc avatar Sep 13 '15 18:09 StanislawSwierc

Thanks for reporting this issue. We have opened a bug on our end to look into this issue for the next public release of Visual Studio 2015

harikmenon avatar Sep 13 '15 21:09 harikmenon