c# - Use difference XAML pages in XBAP -


how go switching main display xaml page gets used in xbap. different want larger mode , smaller mode, same controls (some hidden).

in app.xaml.cs file, can programmatically change window.xaml file want show on startup. here over-simplified example.

protected override void onstartup(startupeventargs e) {     base.onstartup(e);      system.windows.window startupwindow = null;      if(uselargemode)     {          startupwindow = new largemainwindow();     }     else      {         startupwindow = new smallmainwindow();     }     window.show(); } 

you can changing startupuri in app.xaml file going harder change @ runtime.

<application x:class="main.app"     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     startupuri="mainwindow.xaml" /> <!-- change --> 

i've haven't tried binding property in application declaration in xaml, vs 2010 doesn't complain this. concern app had it's datacontext set enough work correctly. give try , let know how works. :)

<application x:class="main.app"     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     startupuri="{binding startupwindow}"> 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -