A Simple Way to Make a Custom WPF Message Box



In my last piece (“A Simple Way to Make a WPF Chromeless Window”) I demonstrated how one could easily create a chromeless window using Microsoft’s “Windows Foundation Framework”, more commonly known as WPF.  This time around I will show you how to make a customized WPF message box.

The reason for this is that the WPF default message box uses the same chrome that the default WPF window does.  As a result, if you are going to develop a custom window you will also have to do the same with your message boxes or the contrasts between the two will not look symmetrical.

And being deficient in the graphic arts like many software engineers I found this out the hard way when my own commercial product was well reviewed except for the interface.  Hence, my recent work to refine the interface to something much more aesthetically pleasing.

Limitations With Your Own Message Box We Can Work With

The first thing to realize is that developing your own message box will constrain you to a certain extent as to what you can provide with it as the default WPF message box comes with a number of configurable options that you can select to produce certain results.  The only problem is that you cannot change how the default message box is displayed since it is reliant on the Win API.

Essentially, a message box will request a user to do one of two things, read the provided information and move on, or ask a questions, which is in practically all cases a “yes” or “no” question.

Luckily, with the WPF modal dialogue, which is the type of window we will use for our message box, we can easily return a “true” or “false” value allowing us to handle the second scenario noted previously.

Read more of this post

A Simple Way to Make a WPF Chromeless Window



Microsoft introduced the “Windows Presentation Foundation” or WPF to align desktop development with similar experiences developers have with developing web applications.  With the exception of possible a rather weak graphical interface for creating windows and pages, WPF for the most part offers desktop developers a quality foundation for delivering desktop and desktop-styled applications into production environments as well as multiple mobile platforms.

Like with web development that now has it’s interface and coding constructs more or less separated between HTML/CSS and client\server side coding (though the client side coding model is merely a throwback to “Classic ASP”), WPF provides a similar format.

In WPF you have both Window and Page objects similar to the original WinForms environment where one could have a Window and page-like controls whereby both can have Windows displaying Pages within them.

Unlike web development, Microsoft for some reason has chosen to make styling WPF Windows and Pages an utter nightmare for developers to wrap their heads around.  Though CSS, which can become awfully complex in the hands of a skilled web developer, CSS still retains a sense of simplicity that most web developers can attain skills with in order to make their web pages acceptable.

WPF on the other hand takes CSS simplicity and turns it on it’s head by implementing templates that provide base styling for every one of the WPF controls provided by either Microsoft or third-party vendors.  For many what would be considered minor styling options with CSS, WPF presents an array of complexity for developers that has many throwing up their hands in disgust.

One would think that having the need for a completely separate application from Visual Studio to design WPF styles in the Guise of “Blend”, such a process would have been made much easier.  And it would have been had the styling terminology used would have been turned into simplistic language that everyone could understand instead of the ambiguous terminology that has most turning to the Help systems for clarification.

Making a simple styling change such as the color of the selection highlighting in a WPF list-box could have one implementing the entirety of an updated list-box style template into a page, which is extremely verbose or finding a way to add styling resources to the same.  In either case, the research needed to find quality information on such processes can be quite extensive as there are really few quality manuals that deal with WPF styling in a simplistic and straightforward manner.

One of the things that many developers would like to be able to provide their clients and users are Windows without the ugly chrome that surrounds them that is similarly ever present with web browsers.  Interestingly enough, most developers are under the impression that to do this they require an expensive tool suite that provides for chromeless windows as well as advanced styling.

Admittedly, I was under the same impression and my own commercial product has suffered the same visual detriment that many have… until recently.  After doing a lot of research on the subject with the intent of avoiding an expenditure for a tool suite I did not believe justified I found enough information to put together such an interface finding it far easier than one would believe once I sifted through the various documents others had put up on technical sites.

Read more of this post

“Digital Crack” – A Self-induced Nightmare


By now many are aware of the ongoing fight between the FBI and Apple over the FBI’s request to have Apple devise a version of it’s iOS operating system that will include some form of encrypted backdoor access to all of the company’s customers’ iPhones and iPads.  Oddly enough, the same request hasn’t been made for Apple’s desktop systems or their laptop line.  If it has, it so far has not been mentioned in the press.  Nor has a similar request been made to Samsung (at least not as publicly if it has been made), most likely a result of it being a foreign corporation.

The reaction has been, and rightly so, quite fierce from the technical community who see such a request as compromising the security of customer devices for the possibility of having complete access by the FBI if it deems it warranted.  Similarly, the CIA has weighed in, in the FBI’s favor on this matter.

Considering that the NSA is already scooping up every electronic transmission it can get it’s hands on, both within the United States and outside of it, the request by the FBI appears to be rather redundant though criminals with any brains, would not electronically transmit any incriminating information in the first place and as such, probably would not hide such information on a device that can be easily stolen or lost.

Yet, the FBI request in question appears to center around access to the smart-phones of the San Bernardino shooters only a few months ago.  And here the local police have demonstrated that such access would probably yield little if any worthwhile information since they had pieced together all of the needed information through normal investigative means.

Whether you believe that the San Bernardino attack was a “False Flag” operation or not (and there is some evidence to suppose that it was), the mainstream media presentation of the situation has already been founded on the acquisition of data through normal investigative channels.  For example, the police investigators have found absolutely no links between these shooters and any radical terrorist organizations, though they may have been influenced by the propaganda from such groups.  If there are no links found in any avenues of normal investigative procedures, it is unlikely that such contradictory information would be found on one or two smart devices in the shooters’ possession.

Being that as it may, allowing any government or business organization to have an open-door pathway into one’s privacy at such a level is somewhat ridiculous given the technical challenges it poses and the fact that once provided leaves such a path also open to those who are part of the criminal mindset that the FBI is trying to get information on in the first place.  In this case, you simply can’t “have your cake and eat it as well”.

Read more of this post

Using the Xceed “Busy Indicator” Control


By now most .NET developers who are developing with Microsoft’s “Windows Presentation Foundation” or WPF are familiar with Xceed Software’s popular and freely available suite of additional WPF controls. One of the more confusing ones to work with is the “Busy Indicator” control, which many developers would like some form of within certain areas of their applications.

A little research on the Internet for either Xceed’s offering or any other will demonstrate the implementation of such a control is a bit more complex than would have originally been thought. As many who have tried and found out, the implementation is quite a bit more than just setting the control’s “busy” property to “True”.

There are quite a number of articles across the Internet that show how such a control can be implemented. Some of them appear so complex that one would not be blamed for simply not going through with the endeavor.

The complexity that comes with the implementation of this type of control stems from the fact that you must have some knowledge of handling multi-threaded processes in a WPF application. There is no getting around this since you must separate the process the “BusyIndicator” control is to cover for from the main UI thread. This is because, once a time-consuming process on the main UI thread has been initiated, there is no possibility of updating the display to inform a user of what is occurring even if such updates are made within the process itself. That can only been done through calls from the secondary process to the UI process. All of this will be shown in the steps outlined below.

Hopefully, the following will make such an implementation easier.

Read more of this post

Best Text Editor Component for .NET WPF Developers


Overview of The Solutions Available…

For those software professionals creating desktop applications for distribution and\or sale there situations where there is a requirement to present edited text to the user or allow the user of an application to enter text as they would source-code in one of the many current IDEs available.

Most often such applications would be directed at other technical professionals thus proving a need for a quality text-editor control that can be configured to the application’s requirements without having to develop one from scratch.

There are several options in this regard that are available to .NET WPF developers who need to incorporate such a component into their applications. One of the popular open-source components is “ScintillaNET”, which can be found in its most current form at https://github.com/jacobslusser/ScintillaNET

Read more of this post

Simple Theming with WPF



When one researches how to set themes with WPF, what is found is a host of articles describing templates, resources and the subsequent support information needed to add such styling into a WPF application.  Here is a link to a very nice article on “The Code Project” that describes quite a bit on the subject in an organized fashion.

A Guided Tour of WPF- Part 5 (Styles)

If one were to take a look at the article (Yes, it is somewhat dated but still quite relevant.) they would see a level of complexity that many may not want to invest in while developing their own WPF applications.

Read more of this post

Disciplined Application State for WPF


In the last article a concept for implementing an organized technique for managing session and application state for an ASP.NET application was proposed.

The same can actually be done for a WPF application, though such global properties would be most likely be on the minimal side of things.  Nonetheless, there are times where having access to a property at application level can be quite convenient.

Read more of this post

%d bloggers like this: