Background color of VS Package Addin? - c#

this may be a pretty simple question.
I've created a VS Package and it has a nice little GUI. The background of the GUI should be System.Colors.ControlBrush:
<Grid Background="{x:Static SystemColors.ControlBrush}">
Now I have the problem, that it changes the color of the Grid, but not of the rest of the window. -> Screenshot
I thought I could change the background of the UserControl the same way, but somehow it doesn't work. Now it doesn't really look that great, if a part of the window is grey and the rest is white.
Any idea?

Your UserControl is probably not covering the entire window.
Remove any Width or Height attributes and make sure that the Horizontal/Vertical Alignments are both Stretch.

Related

how to remove the circle around the wpf expander arrow? [duplicate]

Is there a way I can change the icon of the expander to +/- with the color white as the foreground color? I've been looking everywhere but cant find a simple solution. Or better yet, how do I change the color of the expander icon to white? My background is a dark color, so this is why I'm asking.
You will need to create a custom control template, see this CodeProject article: http://www.codeproject.com/Articles/248112/Templating-WPF-Expander-Control
You need to change the Template, you can base it on the existing template though.

Autosizing controls issues

I'm having a problem with auto sizing all of the controls on my WPF. I'm able to get them too stay on the side of the screen where I want them, the only problem is that, when I have the window the same size as the editor, it looks perfect, however, when I change too full screen (Has too be full screen), it centers everything rather then stretching too fit across the entire window.
Any idea how I could go about fixing this? I have provided a few photos.
After doing a lot of research, I found putting it in a panel, and then making the panel Anchor too none and then setting the Alignment too none, it fixed the windowed version but not full screen version. Any help would be great.
I'm setting the window too full screen with this.WindowState = FormWindowState.Maximized; if that makes any difference at all?
The grid should help you with that, just define columnas and rows. Then put the controls inside the rows and change the alignment (vertical and horizontal) to stretch and you are done.
You will have a problem with the text size, that need tl be managed in code behind or in your viewmodel
If you want a control to span on mĂșltiple rows or multiple columns use the grid.rowspan and grid. Columnspan properties.
Sorry for the bad formatting, im on the phone

How to Add Image Background on MetroFrameWork C# Winform

I use metroframework GUI on Winform. I imported the files correctly. Other controls and properties are fine, but I found a problem, I couldn't change the background of a form to an Image file. I can see a small picture already imported at "Background Image" properties of a form. But the background is still white. Could someone please help? Thanks!
MetroForm I believe only has a Light and Dark Theme (White and Black). This can be changed under "Metro Appearance" > "Theme".
Then you can set a background image under "Metro Appearance" > "BackImage".
To have the image change with the Theme you would set "Metro Appearance" > "ApplyImageInvert" to true.
I don't think there's any option other than the Light or Dark Theme.
Hope this helps
EDIT:
To prove that you CAN add an image to the background using MetroFramwork and to negate the downvote.
Here are some screenshots:
Light:
Dark:
Settings:
In the properties menu set:
1. ApplyImageInvert to true
2. BackImage with your path
2. BackMaxSize to the size of your background image
Unfortunately, MetroForm doesn't support a background image. I suppose it's because that doesn't really fit into the Microsoft Design Language (Modern, Metro, whatever it officially is called).
The reason you're seeing BackgroundImage in the PropertyGrid, is because MetroForm is based on the Windows Forms Form control that supports background images. If you take a look at the MetroForm and MetroFormBase code, you can see that all the painting is overriden and there's not a single place where a background is drawn.
If you really want to have a background in your form, you can fork the project and implement it yourself. It's quite a small addition and shouldn't be much of a trouble.
Edit: To be clear, the original project, or one of the forks of the project don't have a capability to show background pictures on the form. It however seems that at least one of the forked projects do support Form background images using the BackImage property, as mentioned in ryantpayton's answer.

Change WPF control property on one theme only

I know this is a little petty, but... On Windows 7, the default foreground color for ListViewItems is, for whatever reason, dark blue. This confuses and infuriates me. I would like to make my ListViewItems have black text. But if I set my TextBlocks in the DataTemplate to have Foreground="Black", then it looks weird on Windows XP, since the Foreground of the selected item is supposed to be White on XP; with Foreground="Black" it's quite hard to read. Is there some way I can set the Foreground to Black only on the Aero theme and not on the other themes?
What about if someone uses a theme that you have not tested? You cannot control every single theme.
I suggest you to build your own ControlTemplate to achieve your desired visualization. In this way your controls will be displayed in the same way in all situations.

WP7 Trouble customizing DatePicker control

I'm using the DatePicker control from the WP7 SL toolkit. It navigates to DatePickerPage.xaml, which has the scrollers for date picking. I want to keep all the functionality, but change the colors. I'm messing around with DatePickerPage.xaml and updating colors to fit my needs.
I've been able to update the text colors on the scrollers and header, but I can't figure out how to update the background color on the selected item in each or the square outline while the scroller is active. Based on tests I have done with changing the background color of the DatePickerPage.xaml, it appears that the selected item and square outlines are an opaque version of the background color. Unfortunately, this wont work for me, since I want the background to the be white and the outlines aren't visible. Is there a way to explicitly set those colors?
If you get the control into Blend and right click on it and select Edit Tempate --> Edit a Copy, you'll get the template for the control so that you can edit it.
What you'll be looking for is the resources keys that are used for the background, foreground, etc. You can replace them with your own resources, or hardcode them, or the best option is to override the resource.
Additional Advice
Be careful though, don't forget that a user can have either a dark or light background to the phone, so unless your app is taking control of the background color of the whole page, you need to consider what might happen when picking colors

Categories