locked
Design Preview Difficulties, what should I do? RRS feed

  • Question

  • I'm having a problem previewing a program in the design view...  When I open a certain XAML file in blend 2 nothing shows in the Design Preview.  I can open other xaml files within the same solution and I can view them in the design view with no problem.  No errors show up in VS or Blend 2 and it runs without error!  What am I doing wrong?  

    Wednesday, February 18, 2009 9:04 PM

Answers

  •   Nevermind! I ended up reverting back to an older Version and piece by piece I dissected and altered the code until I found the problem...  Blend Does not like editing the styling of comboboxes

    Code Example:
    Style="{StaticResource ComboBoxItemStyle1}" 


    Originally went into Edit Template then into "DropDownToggle" and changed the "BackgroundOverlay" and "BackgroundGadient" to colors that would match my theme, the color was changed and everyone was happy.  I then went to change the rest of the colors, of the comboboxes, and I ran into the "ArgumentException: Value does not fall within the expected range." error and could not view anything in the Design preview panel.

    To fix the problem I went into the XAML, searched of all the comboboxes and deleted the XAML for the StaticResources that I created when changing the mouseover colors in the first place and Bingo... The Design Preview works.  So for now, until I learn more about the StaticResources, everyone will have to deal with the blue mouseover state for the comboboxes.  Perhaps in the future I will look further into theming but that also limits the design capabilities.

    I'm also having a similar issue, "ArgumentException: Value does not fall within the expected range." error, when I update the AgMenu from version 8.2.2 to 8.2.5 but I will tackle that on a later date. 
    • Marked as answer by Dekowski411 Friday, February 20, 2009 7:06 PM
    Friday, February 20, 2009 7:04 PM

All replies

  • Howdy,

    Can you post some markup (XAML) and a more detailed description of that is supposed to be displayed .

    Cheers

    Expression MVP

    Learn Expression Blend at learnexpressionstudio.com

    my blog : http://x-coders.com/blogs/sneaky/default.aspx

    Wednesday, February 18, 2009 10:18 PM
    Moderator
  • Is there a way I can send you the XAML to an email or something? Its too much code!
    Thursday, February 19, 2009 5:01 PM
  • It’s weird!  Usually when there is an error you cannot view anything in the Design view, you can only work with the red squiggles in the code view.  But now I have no red squiggles and I cannot view the program in the design view.  I've cleared and rebuilt multiple times in VS and Blend; no rhyme or reason why it isn't working!

    Thursday, February 19, 2009 5:09 PM
  • I'm getting an "ArgumentException: Value does not fall within the expected range." error.   It doesn't specify what the error is!  Blend is useless to me right now...
    Thursday, February 19, 2009 9:42 PM
  • Hey,

    You can mail your project to me

    admin AT x-coders DOT com

    Give me some time to review it and I will get you a solution.

    Cheers

    Expression MVP

    Learn Expression Blend at learnexpressionstudio.com

    my blog : http://x-coders.com/blogs/sneaky/default.aspx

    Thursday, February 19, 2009 10:00 PM
    Moderator
  • better yet here is a link:

    http://student-iat.ubalt.edu/sde/students/dekowski/XAML_DesignViewProblem.txt


    Thursday, February 19, 2009 11:19 PM
  •   Nevermind! I ended up reverting back to an older Version and piece by piece I dissected and altered the code until I found the problem...  Blend Does not like editing the styling of comboboxes

    Code Example:
    Style="{StaticResource ComboBoxItemStyle1}" 


    Originally went into Edit Template then into "DropDownToggle" and changed the "BackgroundOverlay" and "BackgroundGadient" to colors that would match my theme, the color was changed and everyone was happy.  I then went to change the rest of the colors, of the comboboxes, and I ran into the "ArgumentException: Value does not fall within the expected range." error and could not view anything in the Design preview panel.

    To fix the problem I went into the XAML, searched of all the comboboxes and deleted the XAML for the StaticResources that I created when changing the mouseover colors in the first place and Bingo... The Design Preview works.  So for now, until I learn more about the StaticResources, everyone will have to deal with the blue mouseover state for the comboboxes.  Perhaps in the future I will look further into theming but that also limits the design capabilities.

    I'm also having a similar issue, "ArgumentException: Value does not fall within the expected range." error, when I update the AgMenu from version 8.2.2 to 8.2.5 but I will tackle that on a later date. 
    • Marked as answer by Dekowski411 Friday, February 20, 2009 7:06 PM
    Friday, February 20, 2009 7:04 PM
  • Howdy,

    The Argument exception is caused by a value outside of the expected value range or type being assigned to a property or attribute.

    For example. a property may only allow a value of type double between 0 and 1.0 and you supply 2.5. (This does not always result in an error, it depends on the code handling the exception but it illustrates the concept)

    When you edited the template, did you apply color resources to brushes or did you create the brushes again?

    Cheers

    Expression MVP

    Learn Expression Blend at learnexpressionstudio.com

    my blog : http://x-coders.com/blogs/sneaky/default.aspx

    Tuesday, February 24, 2009 2:42 PM
    Moderator
  • I had the same problem where my site wouldn't render correctly in the blend preview, but it would render correctly in Visual studio and it worked fine at runtime. It turns out that I had applies colors in the place of brushes in a few places.

    If you apply a brush in the place of a color, it will crash, but if you apply a color in the place of a brush, it only fails in Blend.

    Here is example code:
            <Color x:Key="darkPurple">#FF120221</Color>
            <SolidColorBrush x:Key="DarkPurple" Color="{StaticResource darkPurple}"/>
    
            <!--CORRECT -->
            <Style TargetType="Border" x:Name="BorderStyle">
                <Setter Property="BorderThickness" Value="3"/>
                <Setter Property="BorderBrush" Value="{StaticResource DarkPurple}"/>
                <Setter Property="Padding" Value="10"/>
                <Setter Property="Margin" Value="0,5,0,5"/>
            </Style>
    
            <!--WRONG. WILL NOT CRASH, REPRODUCES BUG ABOVE-->
            <Style TargetType="Border" x:Name="BorderStyle">
                <Setter Property="BorderThickness" Value="3"/>
                <Setter Property="BorderBrush" Value="{StaticResource darkPurple}"/>
                <Setter Property="Padding" Value="10"/>
                <Setter Property="Margin" Value="0,5,0,5"/>
            </Style>
    Wednesday, June 10, 2009 9:54 PM