Question

i've built my first wpf application, nothing fancy, but i wanna make it look cool by adding a setup, ive researched in the internet about some free utilites to do it, but since its a wpf app, i wat the setup to go along those lines... any idea how i can create a custom wpf setup wizard?

Was it helpful?

Solution

When building a WPF setup, you neet to solve the problem of .Net bootstrapping - if the client does not have .Net, your setup will not work.

Once you solve that, your setup will need to do couple of things:

  • request admin elevation to access certain file and registry locations
  • deploy all necessary files in %ProgramFiles%\
  • create proper entry in HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall (if your application is compiled explicitly for x86, you'll need to do it in the Wow6432Node on 64-bit machines)
  • create a shortcut in All Programs\
  • do additional stuff like COM registration, file association and so on depending on what features your app provides

Most of these are provided for free by Windows Installer (MSI). You should really use something like WiX to build regular installer, even though it's not going to be as snazzy as WPF can be.

If you really want to be fancy, you could actually build custom WPF UI that's driven by the MSI engine, but the overhead of doing this is probably not worth it.

Update: Here are couple of links that can help if you still decide to build a WPF UI Setup:

OTHER TIPS

Either:

a deployment project in visual studio

ClickOnce

Wix

deployment projects have been around the longest. microsoft seems to be pushing clickonce the most for .net wix gives you the most control over msi

I personally use WiX 3.0 (http://wix.sourceforge.net/) for all my WPF or other .NET based applications.

I've never tried, but I know in ASP.NET, you can add WizardSteps to a MultiView.

In WPF, I'd create a tab control, set the tab height to zero:

<TabControl x:Name="tbcWizard" Background="Transparent" BorderBrush="Transparent">
   <TabItem Visibility="Hidden" Height="0">
   ...

Use a DockPanel or Grid to keep the next/previous buttons at the bottom. The next/previous keys would be mapped to CommandBindings for NavigationCommands.NextPage or PreviousPage, and the CanExecute status of these commands would be determined by the index of the tab control.

if(tbcWizard.SelectedIndex > 0) // can execute back if(tbcWizard.SelectedIndex <= tbcWizard.Items.Count) // can execute forwards

Change the selected index of the control when the buttons are clicked.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top