WPF User Control Apply Style - wpf

I created a custom TimePicker control. It has a label and some combo boxes on it. It is inside a UserControl library.
Now I added a reference to that project in my Desktop project and added the TimePicker to a window.
Finally, I have some styles defined in a 3rd project. I would like to create a style in the Styles project for the TimePicker on my window.
How do I set that TimePicker's style in the Desktop project?

Load Resource Dictionary from your style project.
Set button style defined in your Resource Dictionary.

Related

Theme for devexpress ribbon control in WPF

How to set theme for devexpress ribbon control in WPF? Already installed the WPF theme editor, but there is no item in the product browser to select. I tried property ribbon style, but it does not work either.
Your main window should start with <dx:ThemedWindow > tag.
Add theme references to project by context menu on the references section, DLL names start with DevExpress.Xpf.Themes. ...
Click on smart tag button for the form.
Select application theme from the combobox.
p.s: this solution applies to .net 4.7 or equivalent

How to use .js and .css file in SilverLight application

I am using a customized alert message for my whole application which generates from a .js file and a .css file. I have also used silverlight in my application and shows MessageBox from silverlight with its default design. Now i want to customized that MessageBox in silverlight.
So, can anyone plz help me to know how to add js and css file to silverLight application and how to use it
You can't change the built-in MessageBox style as easily as simply creating your own modal window. There are lots of custom messageboxes about and many have source code.
e.g.
Creating a reusable MessageBox dialog.
Silverlight Modal Dialog With Custom User Controls
Custom MessageBox Control for Silverlight 3
Note: these are all Silverlight solutions, so you are authoring in XAML and with style, not using JS and CSS.
It is also possible to call JS functions on the page from within Silverlight if you think that will be easier for your solution.

How to theme WPF custom controls

How I do define and apply themes to my custom control that is hosted in an ElementHost.
VS created Generic.xaml in the Themes folder. If I renamed it to something else (like Blue.xaml), the entire control does not show up.
Another question is what theme xaml files should be set to in VS: Content, Page or Resource?
You should always have a Generic.xaml defined.
Copy it, and then change your Blue.xaml to define your "Blue" theme.
Build Action = Page
See as you're hosting your WPF control in a Windows Forms Application with ElementHost, then you might have difficulty in it seeing changes to the theme.
See:
http://www.actiprosoftware.com/community/thread/20266/how-to-get-themes-working-inside-an-elementho
Dynamic Application-level resources are not dynamic when hosted in ElementHost

How can I get the default XAML style for the WPF DatePicker control in .net 4?

I am trying to find the default control template for the WPF DatePicker control in .NET 4. I have tried the MSDN page, but the "link" to the DatePicker control is just text. I have tried StyleSnooper, but it has an error when loading PresentationFramework.dll.
Is there any way other than Expression Blend to get the default template?
Thanks.
You can download them from this page, or more specifically here.
FYI you can also used Blend to extract a style for any control.

"Please wait" Windows in WPF

I need to create a "please wait" window at the start up of my application, start animation and at the lifetime of app change visibility. I don`t want create explicitly new thread (Maybe ThreadPool or BackgroundWorker).
Any ideas?
WPF has a very nice splash screen class exactly for that: http://www.codeproject.com/Articles/36418/WPF-Splash-Screen.aspx
Here is the quick steps:
Add the image file to the WPF Application project. For more information, see How to: Add Existing Items to a Project.
In Solution Explorer, select the image.
Add the image file to the WPF Application project. For more information, see How to: Add Existing Items to a Project.
In the Properties window, click the drop-down arrow for the Build Action property.
Select SplashScreen from the drop-down list
(source here: WPF SplashScreen implementing)

Resources