file code provides the constructors, OK button handler and some event handlers implementing the auto complete behavior in the dialog.These controls are bound to the Font properties defined in the FontInfo class. The dialog contains a lot of controls defined in the ChooseFont.xaml which represent the View.FontInfo class plays the role of the Model in the MVC pattern. FontInfo class contains the set of properties describing the Font in the WPF world.The implementation consists of the following main parts: The code behind file contains as little code as possible. I have rewrote the Font Chooser dialog basing on the approach close to the MVC pattern: there is the Font properties class, the Model, and the dialog controls binds to the properties of this model class in XAML. All the logic is implemented in the dialog code behind file, and this file is long and complicated. The dialog controls and layout are defined in the XAML. ![]() There are things I don’t like in both the first and the second implementations: they are written rather in the Windows Forms style than in the WPF one. The only drawback is that the dialog initialization takes too much time. In this case the programmer can fetch the selected color by retrieving the property Font of the Dialog class, and apply it to any WPF Control by using the. Maybe there are other implementations but I could not find them.įrom full-fledged options I prefer the one of Niklas Borson: it has more compact design and, as much as I tested it, all its features work fine. The former two items are full-fledged Font Chooser dialog implementations, and the latter one is the sample of how to implement the basic Font Chooser in pure XAML. ![]()
0 Comments
Leave a Reply. |