locked
Visual Studio 2010, WPF, at design time in Design Pane cannot see applyed custom Styles for controls, but at runtime everything is fine. RRS feed

  • Question

  • I switched from Vista to Windows7, and installed Visual Studio 2010 Ultimate Beta 2. When I open in new studio a WPF project created in VS 2008, in Designer Pane I cannot see controls in view determined by Styles (some controls get only part of their Styles, some get base Style - no derivations, some controls get no Style at all). Surprisingly, at runtime everything gets fine, just as it did look in VS 2008.
    Could anybody give directions on fixing this problem?

    • Moved by Brittany Behrens Saturday, December 19, 2009 8:20 AM (From:Visual Studio Editor)
    Saturday, December 19, 2009 6:06 AM

All replies

  • Sorry to hear this - it is not usual behavior.

    It would help to see sample projects/code that illustrate the problem behaviors you are seeing?

    Thanks

    Mark


    Mark Wilson-Thomas - Program Team - WPF & SL Designer for Visual Studio - posts are provided 'as-is'
    Thursday, July 29, 2010 3:55 AM
  • Hi Mark,

    I already posted the code in the thread. Here it is again. If you insert this into VS 2008 everything is OK. In VS 2010 at design time in design pane you don't see styles applyed, but at run time its OK. So, I've done with VS 2010, I'll be using VS 2008 untill a new VS 2012/2013 or something.

    <Window x:Class="TestVS2010.Window1"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      Title="Window1" Height="300" Width="300">
        <Window.Resources>
      <Style x:Key="digitButton" TargetType="ToggleButton">
        <Style.Resources>
          <SolidColorBrush x:Key="mainColor" Color="#00326F" />
        </Style.Resources>
        <Setter Property="Template">
          <Setter.Value>
            <ControlTemplate TargetType="ToggleButton">
              <Grid Margin="1">
                <Rectangle x:Name="mainButton" Fill="{DynamicResource mainColor}" Opacity="0.75" RadiusX="2" RadiusY="2" />
                <ContentPresenter x:Name="buttonContent" HorizontalAlignment="Center" VerticalAlignment="Center" />
              </Grid>
            </ControlTemplate>
          </Setter.Value>
        </Setter>
      </Style>
      <Style x:Key="operatorButton" TargetType="ToggleButton" BasedOn="{StaticResource digitButton}">
        <Style.Resources>
          <SolidColorBrush x:Key="mainColor" Color="#ee7c11" />
        </Style.Resources>
      </Style>
      </Window.Resources>
      <Grid>
        <ToggleButton Style="{StaticResource digitButton}" Content="ButtonDigit" Height="40" HorizontalAlignment="Left" Margin="105,46,0,0" Name="button1" VerticalAlignment="Top" Width="122" />
        <ToggleButton Style="{DynamicResource operatorButton}" Content="ButtonOperator" Height="40" HorizontalAlignment="Left" Margin="105,119,0,0" Name="button2" VerticalAlignment="Top" Width="122" />
      </Grid>
    </Window>
    
    

     

     

    • Proposed as answer by Adam LaPitz Tuesday, February 8, 2011 6:41 PM
    Thursday, July 29, 2010 4:23 PM
  • This has been fixed in the service pack for Visual Studio 2010. If you wish to install the Beta, it can be found: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=11ea69cb-cf12-4842-a3d7-b32a1e5642e2&displaylang=en.

     

    Thank you for reporting the issue. ,

    Adam LaPitz

    Tuesday, February 8, 2011 6:43 PM