Button with image and Theme mangaer

WPF Studio, Themes, and Shared Library for WPF Forum

Posted 12 years ago by Mary Fontana - Rudolph Technologies
Version: 12.1.0562
Avatar

I have a menu to allow selection of theme.

For buttons with an 16x16 image, the image is blurry when theme is set to Classic or HighContrast.

Here is an example I created.

Any suggestions on how to define button?

 

<DockPanel x:Name="buttonPanel">
            <StackPanel Orientation="Horizontal" Height="30" HorizontalAlignment="Left" VerticalAlignment="Center">
                <Button  Width="24" Height="24" Margin="10,0,0,0"  x:Name="Button1">
            	    <Image Source="Refresh.png"  Width="16" Height="16" />
        	</Button>
                <Button  Width="24" Height="24" Margin="10,0,0,0"  x:Name="Button2" >
                    <Image Source="Refresh.png"  Width="16" Height="16" />
                </Button>
                <Button  Width="24" Height="24" Margin="10,0,0,0"  x:Name="Button3"  >
                    <Image Source="Refresh.png"  Width="16" Height="16" />
                </Button>
            </StackPanel>
            </DockPanel>

 

 public MainWindow()
        {
            InitializeComponent();
            ActiproSoftware.Windows.Themes.ThemeManager.SetAreNativeThemesEnabled(this, true);
            ActiproSoftware.Windows.Themes.ThemeManager.SetTheme(Button1, "Classic");
            ActiproSoftware.Windows.Themes.ThemeManager.SetTheme(Button2, "HighContrast");
            ActiproSoftware.Windows.Themes.ThemeManager.SetTheme(Button3, "Office Blue");
        }

Comments (3)

Answer - Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Mary,

Thanks for letting us know.  It's due to a padding resource for those two themes.  If you add this to your Application Resources until 2012.2 is out, it will work around it:

<Thickness x:Key="{x:Static themes:AssetResourceKeys.ButtonPaddingNormalThicknessKey}">1</Thickness>


Actipro Software Support

Posted 12 years ago by Mary Fontana - Rudolph Technologies
Avatar

Thanks that fixed the display for Button and PopupButton.

 but I also see a blurred icon only for those 2 themes  in my TreeView.  

I define a  HierarchicalDataTemplate  something like this

<HierarchicalDataTemplate 
	DataType="{x:Type local:MyTreeViewModel}" 
	ItemsSource="{Binding Children}">
        <StackPanel Orientation="Horizontal" >  
            <Image Source="{Binding MyTypeImage}" Height="16" Width="16" HorizontalAlignment="Left" Margin="0,1,4,1" />

	     <TextBlock Text="{Binding MyName}"  Height="16" Margin="0,1,0,0" />
         </StackPanel> 
</HierarchicalDataTemplate>

[Modified 12 years ago]

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Mary,

Sorry but I'm not able to repro the TreeView issue.  Could you make a new simple sample project that shows it and e-mail it over to our support address?  Please reference this post and rename the .zip file extension so it doesn't get spam blocked.  Thanks!


Actipro Software Support

The latest build of this product (v24.1.2) was released 1 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.