I'm using the expression dark theme for one of my WPF apps, I've tried to style it to work with the theme but I'm just to damn bad at WPF styling to get it to work, do you guys now if someone have styled the Datepicker to match Expression dark?
http://wpf.codeplex.com/wikipage?title=WPF%20Themes
Answer to your question is YES.
I am just pulling your nose. DatePicker is really complicated one. Best you can do is utilize Expression Blend to get default template and work with that. Of course ControlTemplate for DatePicker is not enough... but I am sure you already know that.
You have to edit templates for all parts of Datepicker and all parts of Calendar
So if you use Expression Blend to play with those default styles... you will end up with styles for
Datepicker, Button(part of DatePicker), DatePickerTextBox, Calendar, CalendarItem, CalendarButton, CalendarDayButton.
You can edit them one by one.
I would really be happy to post code here, but it has over 500 lines. And I am sure that now - when you really know what you want to edit - you can do it yourself. You don't want to copy-paste it :)
Related
In wpf, is it somehow possible to lookup the definition of the default style of a control?
In this question I saw an example thereof, see: "just for a reference, here's the default MenuItem's style". Where did he/she find it?
using Expressin Blend is the best answer for this.
in Expression blend select the control on which you whould like to see the tamplate then right click and select the template then Edit a copy. this will create a copy os used tempalte will explorer the orignal template if you are not using any theme.
On the other hand you can look for http://wpfinspector.codeplex.com/
Good Afternoon,
I am trying to customise the NavigationPanel UI Back and forward button, i basically just want to change the colors. I cannot find a property that can be set so i am a little stuck.
I believe the way forward is to amend an existing template and set the Page.Template property as the new control template? Am i going down the correct route? Where does this Xaml belong to, under the Application.Resources / Page.Resources?
I believe the Template is http://msdn.microsoft.com/en-us/library/aa970054.aspx
Apologies if this is a basic question but i am trying to learn Xaml / Wpf.
Thanks for your help in advance...
I found a good example of this under samples on Msdn:
The link:
http://code.msdn.microsoft.com/Customized-NavigationWindow-ced9d7af
I then used the default template as above and amended the xaml to the effect i wanted. Simple when you can find a sample. :-)
As you know, the built-in themes all define styles for the standard controls such as the TreeView control. We're trying to create something that looks an awful lot like a TreeView but isn't actually one, nor is it a subclass of one. It just has parts that we want to look like one for consistency.
For instance, our control too has a selected item whose background we'd love to match to the appearance of the background for the selected item in a TreeView (or more accurately the TreeViewItem) for the current theme. (You can't simply use highlight color as the themes have nice gradient brushes and borders, not just a solid brush.) Same with our expand/collapse togglebuttons. We want them to look just like the ones used in a TreeView for the current theme. (i.e. Sometimes a triangle, sometimes a box with a '+' in it, etc.)
Now while we can simply rip open Expression and copy the styles ourselves (or at least the parts that we need), we'd have to do that for each and every theme that MS provides. Plus, that wouldn't handle newer themes. And in a purest standpoint, that's duplicate styling information which just sits wrong with me.
Also, if someone styles the actual TreeView(Item), we want to pick it up as well. Since the parts that we want to style are required parts of a TreeView, we feel pretty confident that they're in there somewhere style-wise.
Not even sure what I want to do is possible but if anyone knows, they're most likely here on SO!
Yet another question close to a month old without even a comment. Very odd for the SO community to not chime in at least once! Guess it's not possible.
Well, what we ended up doing was using 'Show Me The Template' (Google it) to get the templates for the part (we don't have Expression), then manually managing them ourselves instead of using the built-in styles. NOT at all what we wanted to do since we don't know of a way to get the nice gradients that are defined in the system already without duplicating them, but the end result does match perfectly so there's that. As such, this too is getting marked as the answer. I'll gladly change it if someone else actually gives me one that works (or is close enough! Just need something people! Feel like I'm posting in a vacuum here!
I wanted to know which one amongst Style and UserControl would be better to use in WPF?
For example:
I have created an image button in two different ways.
One uses Style and ContentTemplate property is set.
It uses one other class with dependency properties.
The other way is I have created a UserControl which has a button and its content property is set.
The file UserControl.xaml.cs also contains the dependency properties.
For Code details see the answers of this question:
Custom button template in WPF
Which one would be better to use? In which scenario should one go for Style or UserControl or any CustomControl?
Styles are limited to setting default properties on XAML elements. For example, when I set the BorderBrush , I can specify the brush but not the width of the border. For complete freedom of a control’s appearance, use templates. To do this, create a style and specify the Template property.
Styles and templates still only allow you to change the appearance of a control. To add behavior and other features, you’ll need to create a custom control.
For example,
To create a button like a play button use styles and templates, but to create a a play button which will change its appearance after pausing it use UserControl.
For this type of thing I would go with Style, even though I'm not really adept with graphical tools. I tend to produce a basic, boring style that I can get started with and then prettify it once the application functionality has been verified.
The nicest thing about WPF is being able to distance much of the graphical look, feel and behaviour away from the code.
This allows you to change the style of your application without revisiting the code and indeed means that you can change styles on the fly at runtime.
There is an awkward line to tread with regards to how much behaviour is placed within the XAML and how much is placed within the code. A rough guide would be to decide on what behaviour must always be present within the UI and place that in the code, everything else place within the XAML.
Think of the code as being an abstract class with defined interfaces and the XAML Styles as being classes based on that class and you'll get an idea of what I mean.
Conversely, I know that people who are far more adept at the GUI work prefer to put more functionality in the XAML and others who prefer the code side, because they find the GUI work slow or difficult.
When thought of that way you'll see that there's never really a right or wrong answer, just better solutions that suit your skills.
I'm trying to apply a specific style to a slider control and I'm having trouble figuring out what I need to do for the slider's background. What do I need to do to get something like this triangle to show in the background of my slider?
I initially thought I would define a GeometryDrawing and set something in the tickbar tag to it - but I can't find anything suitable.
This is what I'm looking for. Thanks for any ideas.
Slider background http://img16.imageshack.us/img16/690/slider.png
Check out my Intuipic project, which does something similar (only horizontally):
you need to investigate a bit more into styling and templatiting in wpf. I would expect the easiest way would be to define a Control Template but you 'might' be able to achieve this with just styling
Check out this page on msdn for starters. There is probably loads of other resources out there. Big sections on it in the book i'm reading at the moment - pro wpf in c# 2008
Sorry i'm not coming up with an example... you'd be better off doing a bit of background reading and then coming back with any specific issues.