How to style the thumb of wpf slider? - wpf

I read about style here:
http://msdn.microsoft.com/en-us/library/cc278073(v=VS.95).aspx
I created a UserControl with slider and UserControl.Resources section. I paste the thumb style but some tag are not recognized like vsm:VisualStateManager (I'm using VS2010) why ?

That is the documentation for Silverlight. You probably want the documentation for WPF:
Slider Styles and Templates
Edit:
Just to be clear, if you are using Silverlight, you should use Silverlight templates and styles; if you are using WPF, you should use WPF templates and styles.
In any case, the VisualStateManager is a full-fledged part of both Silverlight4 and WPF4, so if you see a template with the "vsm:" namespace, the simplest option is to just remove the prefix where-ever you see it.

Related

Controls from external library not appearing in Telerik project

I'm working on a project that uses Telerik WPF controls (in so called NoXaml mode) and I have a library with controls I would like to use. These are simple WPF UserControls without even any template and contain only standard WPF controls placed inside them (and some logic). All these controls used inside are covered by Telerik templates and work outside of these UserControls. The library works everywhere, except in this Telerik project, in which the controls just don't appear, they are blank. Even a simplest <TextBlock> inside such control is invisible. Drilling down with Snoop sometimes makes them magically appear.
I've read that Telerik projects need to define templates for any custom controls that you create in them, but I'd like the library to be in control of the look of these controls, so my question is:
Can I actually use a custom UserControl library in a Telerik project without having to write my own control templates for them? If so, how to do that? If not, any other simple workarounds?
Thanks.

Edit WPF styles for a "designer"

We have a designer that did a whole concept of GUI for our next WPF application.
If we are able to provide him a "user friendly" way to edit styles, he would have done it by itself.
He only has to edit colors, and small things like Margin, default fonts, ...
Naturally, I tought that Blend would be the solution, but I admit I'm struggling:
Blend allow us to edit the template, but we don't really want to change the whole template, just some color around. We made a small dummy app that has all the controls required to be themed, we edit template in a dedicated theme file, but I can't find how to have the same template applied to every control(e.g. button) in our application
We use DevExpress as library, and it appears that most of their component are composed of a lot of subcomponent(for which I cannot just right-click then edit template). Plus it seems that the devExpress theme have the priority over the templates changes(tested by changing background colors by example)
As a pure developer I would create a "style" that would be applied on all controls of a specific type in our application, but I can't see how to create and edit them in blend?
What approach would you take?
You want to use DevExpress Theme Editor. It will allow you to edit all used DevExpress themes in your application. It has a friendly UI which should be usable by your designer.
Another approach is probably not so friendly for your designer but you can also manually override DevExpress themes with your extended ones (require XAML). I am not sure about the controls but that way you can for sure modify brushes.

Remove back button in ModernUI plugin for wpf

I am trying to develop a modern wpf application using the MUI package. However I do not wish for the back button to be present and I tried to follow the steps mentioned in this link but it is not working.
I am getting errors as controls not defined in namespace, etc. Basically, I cannot get the code to compile. What am I doing wrong?
Because the TargetType property in the Style references controls from the ModernUI library, you need to add the XML namespace for the ModernUI controls in the ResourceDictionary containing the Style.
I don't know what that namespace is, but need to add something like this:
xmlns:mui="clr-namespace:FirstFloor.ModernUI.Windows.Controls;assembly=FirstFloor.ModernUI"

How do WPF themes get loaded?

WPF controls get their default styles, colors and brushes from a theme (Usually, in PresentationFramework.Aero.dll).
What piece of loads this assembly? And where are the resource dictionary stored?
I have my own WPF custom themes and load them in the Application.Current.Resources.MergedDictionary.
However, this does not work if the WPF themed control is hosted in Windows Forms since Application.Current is null.
Is there a way to do something similar to what WPF does? If so, what is it?
You cannot use the WPF themes in Winforms because they are two different technologies. There isn't a similar theme mechanism in Winforms natively. You can use third-party controls that support themes in Winforms. The most notable of these are the tools from Infragistics and Telerik.
Bottom line answer is no, there isn't.
Can you try just adding the theme to the control instead of the Application?
control.Resources.MergedDictionaries.Clear();
control.Resources.MergedDictionaries.Add(resourceDictionary);
(answering my own question)
The way to load a resource dictionary as a theme is to add it to the list of merged dictionaries of the generic.xaml resource dictionary.
There is no other way to load a resource dictionary as a theme.
This works fine when used from WinForms

WPF Generate Xaml template

How do i get the default xaml template for a control?
In expression blend you can right click a control and press style then i generates the current template as xaml.. how do i do this if i don't have expression blend?
You can use XAMLPad or StyleSnooper or Reflector.
just verify this link
Control template for existing controls in WPF
You can use Reflector tool to get resource like xaml of existing controls
.
For WPF,
Control Styles and Templates
For Silverlight,
Control Styles and Templates
.
HI
No way just Use Microsoft expression blend. use trial-ver :)

Resources