Skip to content

Allows dynamic scaling of an Avalonia Window and all of it's content.

Notifications You must be signed in to change notification settings

frederik-hoeft/pmdbs2X.UI.Scaling

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

pmdbs2X.UI.Scaling

Allows dynamic scaling of an Avalonia Window and all of it's content.

This is the solution to this question on stackoverflow.

To use this code you have to:

  1. Derive your application main Window from ScalableWindow and implement the resizing events like in the provided example. (I put a Panel in the bottom right corner of my window to be used for resizing, you'll figure it out.)

  2. Then implement IViewModel in the corresponding view model (see the example).

  3. Call ScalingProvider.Register(window, viewModel); on application startup (after Avalonia is done initializing.)

  4. Now you can Rescale the window as follows:

    ScalingManager mainWindowManager = ScalingProvider.GetInstance<MainWindow>();
    mainWindowManager.SetScaling(1.5d);
    

    This would scale the window of type MainWindow to 150% of it's original size. Scaling is always in respect to the original size.

About

Allows dynamic scaling of an Avalonia Window and all of it's content.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages