0

I've looked through every answer here on StackOverflow but nothing fixed my problem.. I have following style written in App.xaml for my buttons. And this style is linked to my class in another assembly where data is being taken from. This WORKS at runtime, but it's giving me a hard time inside designer. There are no errors in the style itself, the error begings with ControlTemplate.

    <Style x:Key="HeaderBTN" TargetType="{x:Type Button}">
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="Width" Value="36" />
        <Setter Property="Padding" Value="5" />
        <Setter Property="Background" Value="{Binding Path=(style:AppStyle.AccentMain)}" />
        <Setter Property="Foreground" Value="{Binding Path=(style:AppStyle.AccentText)}" />
        <Setter Property="FontSize" Value="20" />
        <Setter Property="FontFamily" Value="Times New Roman" />
        <Setter Property="Margin" Value="0" />
        <Setter Property="DockPanel.Dock" Value="Right" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Border Name="border" BorderThickness="0" CornerRadius="0"  Background="{TemplateBinding Background}">
                        <Grid>
                            <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Name="content"/>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Background" Value="{Binding Path=(style:AppStyle.AccentHover)}" />
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter Property="Background" Value="{Binding Path=(style:AppStyle.AccentButtonDown)}" />
                            <Setter Property="Foreground" Value="{Binding Path=(style:AppStyle.AccentTextDown)}" />
                        </Trigger>
                        <Trigger Property="IsDefaulted" Value="True">
                            <Setter Property="Background" Value="#3b3b3b" />
                        </Trigger>
                        <Trigger Property="IsFocused" Value="True">
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Background" Value="#505050" />
                            <Setter Property="Foreground" Value="#A7A7A7" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

Is there any alternative to this that would leave everything functional? It's important that these resources are dynamic because Users have to be able to change the theme.

Any help is appreciated.

P.S. I use Visual Studio 2013 Professional with Update 5

DethoRhyne
  • 930
  • 1
  • 9
  • 29
  • The designer in Visual Studio has always had some troubles displaying dynamic styling. VS 2015 has made some improvements, but it is still not perfect. The main issue is that the Designer never actually displays a `Window` object. It's a pseudo-window-container type object, so things don't always display correctly. – Stewbob Feb 25 '16 at 19:47
  • @Stewbob I've installed VS2015 Enterprise today, I'll check tomorrow how my 2013 solutions work there and if I can properly connect to all my team foundation solutions. I'll give feedback whether this is resolved or not. – DethoRhyne Feb 25 '16 at 22:19
  • @stewbob problem remains in vs2015 update 1 :/ – DethoRhyne Feb 26 '16 at 06:36
  • This is a new bug in VS2015: http://stackoverflow.com/questions/20332077/prefix-does-not-map-to-a-namespace-a-designer-bug?rq=1 and – 15ee8f99-57ff-4f92-890c-b56153 Mar 22 '16 at 15:18

0 Answers0