bryanpjohnston

A blog by someone with not much to say.

Category: WPF

Segoe UI Symbol Icons and WinRT Button Styling

For button styling in my WinRT app, I would run the Character Map utility, look up the Unicode value of an appropriate looking symbol in the Segoe UI Symbol font family, and specify that value as the content of my button.

<Button Content="& #xE109;" FontFamily="Segoe UI Symbol"/>

It seemed there had to be a better way to access standard icons. It seems that Microsoft provides the standard icons in a symbol enumeration.

So to use the standard icon for “add”, you can style your button like so:

<Button>
    <Button.Content>
        <SymbolIcon Symbol="Add"/>
    </Button.Content>
</Button>

Here are Microsoft’s Guidelines for Segoe UI Symbol icons.

Advertisements

Custom WiX Managed Bootstrapper Application

I put together a sample project to show the minimum code needed to create your own managed bootstrapper application using WiX. I wrote it in C# using the MVVM pattern. This is indeed a bare bones example and if you are serious about writing your own managed bootstrapper application, you should download the WiX 3.6 source code and follow their example (see src\Setup\WixBA).

My solution contains three projects (can download the full source here).

  • TestBA:  The bootstrapper UX.
  • BootstrapperSetup:  The main bootstrapper executable that lists the packages to be installed.
  • DummyInstaller:  A dummy .msi that gets installed by the bootstrapper.

Read the rest of this entry »

Hosting Licensed ActiveX Controls in WPF

Recently we had a need to host some ActiveX controls inside a WPF window. Hosting controls in a .NET Windows Forms app is pretty straight-forward, basically register the control, add it to your toolbox in Visual Studio, then drag-n-drop the control on your form. Hosting the control in a WPF window is possible by the use of a WindowsFormsHost. Here is a walkthrough for hosting an ActiveX control in WPF from MSDN.

However we found that some of our controls gave licensing errors which crashed the application. These were our own custom controls that contained licensed third party controls. Everything seemed to work when the controls were called from a VB executable, but when hosting them in WPF, the controls crashed if the developer license wasn’t installed on the computer.

Read the rest of this entry »