How/Where to Find Microsoft Default Styles for WPF Controls - c#

I am looking to change the style of a control but I basically want to copy part of a default style. Does anyone know how I can figure out what the default style of a control is?
In my case I am wanting to make the column headers in a DataGrid go blue on mouse over like the row headers do.

You can find some templates that are very close to the defaults on this MSDN site
Another alternative is to get a copy of Expression Blend and use it to make a copy of the default style, however Blend isn't free

Contrary to what Rachel says, the link she provides does not provide the default templates.
I have seen using System.Windows.Markup.XamlWriter.Save(myObject.Template) that the default templates are completely different from what that site shows.

Related

MaterialDesign Control Properties (ComboBox)

I use MaterialDesign and I want to change the appearance of the popup window of a ComboBox.
I did a little research and then came across it here.
change combobox dropdown list background color wpf xaml
Miljac’s answer contains the key MaterialDesignPaper. Is there a documentation of these keys?
I am not being offered keys via IntelliSense.
There is no detailed documentation on the resource keys and where they are used. However, you can have a look at the GitHub repository Wiki. There is a page that lists all the brush names, but it does not provide any information beyond that.
If you want to know which control uses which brushes, you can check the control style list. Pick the control style that you use and it will take you to the XAML style files, where you can identify the used brushes, e.g. for ComboBox see line 548 where MaterialDesignPaper is referenced and the subsequent lines from 553 on where the popup background is bound.
IntelliSense is not reliable when it comes to resource dictionaries e.g. merged into the application resources and resources then being used in a custom view. These are limitations of IntelliSense, the resources may be perfectly available at runtime. The same applies to the designer, it may yield warnings that resources cannot be resolved, but in fact they are available at runtime.

LayoutTemplatePath for ImageControl Sitefinity

We're trying to create an extended version of the built in Sitefinity ImageControl by creating a separate toolbox.config entry with a custom LayoutTemplate specified.
This essentially works, however when dragging the control from the toolbox in the editor it does not have the custom LayoutTemplate we specified in the config, it uses the default ImageControl LayoutTemplate.
If we manually change the value in the advanced settings of the widget to our new template, it all works. However, obviously in terms of usability this is quite useless.
Is it a bug that the widget doesn't pick up out LayoutTemplate in the toolbox.config, or is there something else we need to do in order for it to be picked up automatically?
Thanks in advance for your help!
It sounds like a bug to me, you should raise a bug report through the ticketing system.
In the meantime have you tried using Option 2 of this blog posted by Josh Morales:
Mapping External Templates for Sitefinity Widgets
It is written for version 4, but should still work in 5.
I'm still investigating the matter, but in addition to Seans suggestion, you could alternatively you inherit from the image control, hard-code the layout template path by overriding the property value to point to your template, then add that control to the toolbox with a different name.
This is a bit of an extreme workaround, since if this is a bug and gets resolved in the next release you'll have to go back and replace them all again to use the toolbox property...
but it's an option! I'll get back when I know more about why this isn't working the way you expect...

How to make a silverlight treeview not highlight an item when you mouse over it

I know this involves a template some how, but I've done very little work with templates and I don't want to make a whole huge big new template just to accomplish this one thing. The default treeview in silverlight highlights an item when you mouseover it. Is there an easy way for me to make it not do this? I haven't found any other mention of it; most other questions I search for are people asking how to MAKE it highlight, not the other way around.
As per my knowledge, you have to change the Default Template of the TreeView control to accomplish the desired behavior.
The following link provide you the TreeView Styles and Templates:
http://msdn.microsoft.com/en-us/library/dd728671%28v=vs.95%29.aspx

Styling Silverlight Telerik AppointmentDialogWindow

So I am using Silverlight telerik RadScheduler. When creating an appointment using this control an AppointmentDialogWindow pops up. Now, I want to change the look of the window (i.e. its borders, frame etc.)
I am pretty good with Blend but I guess some code - behind will be necessary to set the window style for this Dialog Window.
Any Suggestions?
If you have the full source, go the the specific Theme folder you are looking to implement and grab the SchedulerView.xaml file from there. This is the style file for that specific control.
Reference this resource as a ResourceDictionary in App.xaml or the respective page you will implement the control.
Now when you edit this style sheet it will directly affect how the SchedulerView control operates, including it's child windows.
Warning: this is a cumbersome pain in the neck. Telerik doesn't really like people messing with their styles, and they have acknowledged that they do no typically make it easy for their existing styles to be modified.
Here is how to implement a custom theme:
http://www.telerik.com/help/silverlight/common-styling-apperance-themes-custom-theme-project-telerik-approach.html

How To Track Down Silverlight Style and Template Issues

I have a very large silverlight application. I am using a telerik RadGridView control.
I noticed that the header style of the RadGridView is not the standard header as given out of the box by telerik. I.e. the colours are different and the text is different etc.
I first tried to define my own styles and templates (which work in a test project). They are ignored by the RadGridView.
So I started hunting around our application to find out whether a template or style has been applied to make the header different. I couldn't find it.
Are there tools out there that can show me what templates / styles are applied to a particular control and where they come from? A way to debug it in effect.
I am using silverlight spy, but the free edition doesn't show me everything I need.
UPDATE:
I can see what is happening here, a theme is being applied like this,
Telerik.Windows.Controls.StyleManager.ApplicationTheme = new Telerik.Windows.Controls.Windows7Theme();
So the theme must be overiding any template and styles changes that I apply.

Categories