WPF In-Code Preview Colour Feature VS2019 - wpf

I would like to know if there is a setting for WPF in VS2019 to enable "colour preview" in code, such that when I type the hex colour code it displays the colour (without having to apply the colour to any UI element – just a pure visual preview)?
I have a project, where I use a multitude of colours, and it is getting difficult to keep track of which colour is which, so it would be nice to have a visual guide.
My general code for colours in the Resource Dictionary is:
<Color x:Key="BackgroundLight">#efefef</Color>
<SolidColorBrush x:Key="BackgroundLightBrush" Color="{StaticResource BackgroundLight}" />
Is there such setting in VS2019? I believe I saw something like this in one youtube video, where the hex code was underlined by the corresponding colour, but I can neither figure out how to achieve that, nor can I find the video now.

The newest version of VisualStudio implements this by default now. There is a coloured square next to the colour’s name. Nice.

You can sometimes persuade the colour picker to appear in the properties window.
It is fiddly though and I must admit I can't recall trying with vs2019.
EDIT:
Having just tried this, I couldn't get it to work with just a color. A control like say the background on a grid with the hex in it works ok but the colorpicker doesn't respond at all when I select a color resource.
There's a vsix
https://marketplace.visualstudio.com/items?itemName=NikolaMSFT.InlineColorPicker
Like you're doing, I usually define colours in a resource dictionary so they have meaningful names.
Once I've done that, the actual colour matters a lot less.

There's a vsix
https://marketplace.visualstudio.com/items?itemName=NikolaMSFT.InlineColorPicker
This extension can't be installed in VisualStudio 2019 Pro, but you can use this method mentioned in another answer as workaround to install it in VisualStudio 2019 Pro.
https://stackoverflow.com/a/62040646/7387963

Related

wpf / Visual Studio default styles

If I open a new project, and put a label or button on the main window, I get the Segoe UI font at size 12px.
Where is this coming from? Can I choose what I would like the default font / size to be? I had a good look around but can't find anything.
Thanks
The available fonts are set according to System.Windows.Media.Fonts.SystemFontFamilies.
If multiple versions of the same font family reside in the same directory, the Windows Presentation Foundation (WPF) font enumeration returns the most recent version of the font. If the version information does not provide resolution, the font with latest timestamp is returned. If the timestamp information is equivalent, the font file that is first in alphabetical order is returned.
There is also Fonts.SystemTypefaces.
Presumably it is possible to change the selected family or create your own. In fact it is, this post (WPF - Add Custom Font) gives more information on this.
I hope this helps.

drawingbrush not found in visual studio 2010/2012

I have to mention first that I have never worked with silverlight before.
I'm currently starting a project and I need to work with DrawingBrush... to resolve this task
I'm developing in visual studio 2012 and sometimes in 2010, the project is Silverlight5
This is the context where I need DrawingBrush
<Image Source="Images/image.png">
<Image.OpacityMask>
<DrawingBrush>
...
</DrawingBrush>
</Image.OpacityMask>
</Image>
The problem is I can't find use DrawingBrush... it doesn't find it's reference. Intellisense says:
"The type or namespace name 'DrawingBrush' does not exist in the namespace 'System.Windows.Media' (are you missing an assembly reference?)"
Do I have to include something or add a certain reference to my project to use DrawingBrush?
Thanks!
I suggest you to do it in different way.
Convert this image into WriteableBitmap (pixel information) as WB1.
Take another WriteableBitmap as WB2 of same size field with Black color pixel.
Render WB2 as image. Now whenever required you can copy specific pixels from WB1 to WB2 and display the modified WB2.
The following project/sample code will help you to learn to work with WritableBitmap. You just need to learn the following things from this project.
How to read pixel information from an image.
How to modify those pixels information
and how to display the modified pixels
information as Image
Sample Code: http://code.msdn.microsoft.com/CSSL3WriteableBitmap-960deef6
This project supports Silverlight 3. So definitely it will be supported in Silverlight 5.
Hope this helps!

Searching for a default "check mark" icon

I am currently searching for an icon that shows a green check mark, such as this:
Basically what I want to do is the following: My C# WPF application contains a ListView with some entries and each of the entry gets validated. Depending on the outcome of the validation, such a green check mark or a red cross should be displayed.
I found a very nice red cross in the class SystemIcons. It is called SystemIcons.Error. The SystemIcons class also provides other icons like "Exclamation", "hand", "Shield", "Question" and various other icons, however there is no such a check mark thing.
Does anyone know whether such a check mark icon exists in some default library? I googled but I could not find anything alike. In case there is no such Icon, I would have to take some image from the web (like I posted here), but that would be the last option since my application should look consistent and I'm pretty sure Microsoft uses lots of those green things in many places of Windows. So there must be some icon I could use, right?
Best wishes,
Christian
If you're using one of the full versions of Visual Studio, you could always check out the Visual Studio Image Library that comes with Visual Studio.
I'm double checking now to make sure it contains something like what you're looking for.
What size icon images do you need?
If 16x16 will do then I'd recommend the silk icon set at famfamfam.com. This set is nice and consistent, and contains a green check mark.

How to find the correct color to edit with the Visual Studio 2010 Theme Editor?

I really like the Dark Expression theme for the Visual Studio 2010 Color Theme Editor, apart from a few things here and there.
One example is that certain UI elements (such as e.g. Smart Tags) are almost unreadable because they have dark text on dark backgrounds.
I know that I can use the Customize Colors dialog(!) box to edit the colors, but how do I figure out which color to edit?
There's a lot of colors, and it's not very apparent which ones control which UI elements. Is there any way to figure that out?
you can snoop Visual Studio to find out more information about the colors used etc. With Snoop you can even change the colors and look at the results instantly!
So you can just read out wich color is used on wich place and then search the color by name.

WPF Dockable Windows Like iGoogle

I'm looking for a dockable windows/panel control in the style of iGoogle. All of the ones I have found so far all have a fixed length on the height of your window/panel but I want to be able to have windows of varying length like iGoogle.
The best I have found so far has been a control libarary called BlackLight which does not have the feature explained above.
have you seen this docking library:
http://www.codeproject.com/KB/WPF/WPFdockinglib.aspx

Resources