Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

MaterialSkin with .NET 4.0

[img]http://2.1m.yt/rWC3Gt.png[/img]


Hello dear HF users!

This is a tutorial dedicated for beginners at the first place, but anyone may contribute to it. The purpose of this tutorial is to explain how one could use MaterialSkin in 4.0 (dot)NET. I keep it important to explain because MaterialSkin is an awesome theme and I was advised it was a good programming practice to lower the resources to 4.0 .NET, at least. I think, this explanation deserves a tutorial because although I could use MaterialSkin in 4.5 .NET just fine, I met some issue when trying to use it in a 4.0 .NET example. I have resolved the issue and now I am providing my experience along with my explanation in this tutorial. Enjoy!

MaterialSkin is a theme I have used in the past and could recommend to anyone who is looking for a clean design for her / his application. Blink has nicely created a high quality tutorial about it in 2015. You can find that tutorial there https://hackforums.net/showthread.php?tid=4671803 I advise you to read that tutorial and the replies below the thread especially if you read about MaterialSkin first time in your life. The difference between Blink's tutorial and my tutorial is I am writing how it is possible to use MaterialSkin in .NET 4.0. So, if you would like to use the theme in an other .NET, you do not have to go through this tutorial. The reason why I chose .NET 4.0 to run MaterialSkin in was originated from Rawdns, who is a professional C# programmer and advised me the following

Quote:[7/17/2016 4:34:45 PM] Rawdns: Always best to run on the lowest version that your codes needs
[7/17/2016 4:34:52 PM] Rawdns: So that the compatibility issues are lower
[7/17/2016 4:35:04 PM] Rawdns: Most stock computers come with lower versions of .NET





How did I meet with the problem?

Purely for personal interest, I have cloned materialskin from GitHUB, created a 4.0 project, compiled the .dll from the GitHUB project, added the reference from the 4.0 project to the .dll and tried to build it, but it did not work, nor with the given example project when I tried to compile it in 4.0. It worked out well with 4.5 both ways I tried but never with 4.0.

What was the problem?

The following was the error message I got in Microsoft Visual Studio

Code
Error 4 'MaterialSkin.Controls.MaterialToolStripMenuItem' does not contain a definition for 'HasDropDown' and no extension method 'HasDropDown' accepting a first argument of type 'MaterialSkin.Controls.MaterialToolStripMenuItem' could be found (are you missing a using directive or an assembly reference?)

How did I resolve the problem?

I have written HasDropDownItems instead of HasDropDown and I got it compiled & run seemingly all rightly.




So, here is the complete tutorial from the start:
  • 1) First, create working project in .NET 4.0, to start with I recommend the example project in the skin's mother folder

  • 2) Compile the GitHUB cloned skin files into a .dll in .NET 4.0

  • 2.1) When it drops the mentioned error, just replace HasDropDown with HasDropDownItems

  • 3) Add the compiled .dll to your project's references

  • 4) Compile your project & enjoy




Thank you for reading my tutorial and I truly hope you will find it helpful!




Credits:
Blink - Thank you for your awesome tutorial
Rawdns - Thank you for advising me from your professional experience

Regards from
[Image: qp0UIPa.png]
The Society

The MaterialSkin theme made by Blink was a very good approach, however, ButchersBoy has made an amazing job recreating Google's material design in WPF.
He made almost all the controls and he's still updating it, you should really check it out (MaterialDesignInXamlToolkit).
(Jul 24, 2016 09:13 AM)PavilionVI Wrote:  The MaterialSkin theme made by Blink was a very good approach, however, ButchersBoy has made an amazing job recreating Google's material design in WPF.
He made almost all the controls and he's still updating it, you should really check it out (MaterialDesignInXamlToolkit).

I thank you for contributing under this thread!

For first sight, an important difference between Blink's and ButchersBoy's version is: the previous ( with its tutorial ) was made for WinForms while the latter is for WPF. Still, I keep it possible that one may be used in the other type of project, but it may throw some questions to beginners.

Anyway, I will check the WPF version and - if I consider I can provide any educational value from it - share my experience in a new thread.

Regards from
[Image: qp0UIPa.png]
The Society

A bit Off-Topic:

The reason why I chose .NET 4.0 to run MaterialSkin in was originated from Rawdns, who is a professional C# programmer and advised me the following

Quote:
[7/17/2016 4:34:45 PM] Rawdns: Always best to run on the lowest version that your codes needs
[7/17/2016 4:34:52 PM] Rawdns: So that the compatibility issues are lower
[7/17/2016 4:35:04 PM] Rawdns: Most stock computers come with lower versions of .NET


Maybe you and/or @Rawdns should check this link:
https://msdn.microsoft.com/en-us/library....110).aspx

The 'clue' here is use supportedRuntime tag in the right way on app.config file.

I'm developing professionally in .NET since 2004 and this:

[7/17/2016 4:34:45 PM] Rawdns: Always best to run on the lowest version that your codes needs

Is just wrong. You should always use the HIGH version possible. This is not Zilog80 "dixit", is MSDN best practices::

Quote:If you have any control over which .NET Framework versions are used to run your app, use newer .NET Framework versions instead of older ones. This is because many compatibility issues in 4.x versions of the .NET Framework have been fixed in subsequent versions. For example, there are fewer compatibility issues moving between 4.0 and 4.6 than between 4.0 and 4.5.


Source (Must read): https://blogs.msdn.microsoft.com/dotnet/...atibility/

Hope it helps. And sorry for Off-Topic


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by huntersJun 18, 2017 09:54 AM 4 129 Jun 18, 2017 09:54 AM
Last Post: hunters
[.NET] by BlinkJun 10, 2016 01:58 PM 88 9,095 Jun 10, 2016 01:58 PM
Last Post: SIM-1676753