slow-cheetah icon indicating copy to clipboard operation
slow-cheetah copied to clipboard

xaml support

Open cyciopes opened this issue 8 years ago • 3 comments

Is there any plan to support xaml transfromation?

cyciopes avatar Jan 25 '18 09:01 cyciopes

Just wondering why you would want to do this? Is it something that can be done at run-time, during packaging, or deployment?

icnocop avatar Mar 23 '18 04:03 icnocop

I'd like to transform WPF views. I think it will be awesome to get different UI by just using corresponding build configuration and it will be good practices of MVVM. @icnocop

cyciopes avatar Mar 24 '18 11:03 cyciopes

This can already be done by using the existing implementation, and it doesn't require transforming XAML. For example, you can configure SlowCheetah to transform app.config based on the configuration, and then the application can be implemented to read the transformed settings in app.config during runtime and dynamically display the appropriate view in XAML. This implementation doesn't depend on whether MVVM is used or not.

  public partial class App : Application
  {
    protected override void OnStartup(StartupEventArgs e)
    {
       // get transformed appSetting based on the configuration
       string configurationName = ConfigurationSettings.AppSettings["ConfigurationName"];

       if (configurationName == "Debug")
       {
              // display the debug view
              DebugWindow debugWindow = new DebugWindow();
              debugWindow.ShowDialog();
       }
       else 
       {
              // display the release view
              ReleaseWindow releaseWindow = new ReleaseWindow();
              releaseWindow.ShowDialog();
       }
    }
  }

icnocop avatar Mar 26 '18 06:03 icnocop