Giter Site home page Giter Site logo

winui3appbar's Introduction

WINUI 3 Appbar

Implementation of an AppBar (taskbar) in WINUI 3. Similar to WPF and WinForms Appbars.
Includes an example webview (webview2) window that is docked to the appbar when open.

AppApbar3

Requirements

You can find more information in here: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/set-up-your-development-environment?tabs=vs-2022

Because the included example docking window uses webview 2 you will also need to install Webview2 Evergreen Runtime (https://developer.microsoft.com/en-us/microsoft-edge/webview2/?form=MA13LH) or simply remove (comment out) the webview from code

Capabilities

  • Allow docking to any side of the screen
  • Multiple monitor support
  • Handles per-monitor DPI scaling

To do

  • Build into Library
  • Drop and drag
  • Bug fixes
  • watch for other appbars comming and going to automatically adjust.

License

MIT License

winui3appbar's People

Contributors

tomhoh avatar

Watchers

 avatar

winui3appbar's Issues

alternate window funtions

var scale = (this.Content as FrameworkElement).XamlRoot.RasterizationScale;
this.AppWindow.Resize(new((int)widthscale, (int)heightscale))

Link

private async Task SizeWindow( AppWindow appWindow )
{
    var displayList = await DeviceInformation.FindAllAsync
                      ( DisplayMonitor.GetDeviceSelector() );

    if( !displayList.Any() )
        return;

    var monitorInfo = await DisplayMonitor.FromInterfaceIdAsync( displayList[ 0 ].Id );

    var winSize = new SizeInt32();

    if( monitorInfo == null )
    {
        winSize.Width = 800;
        winSize.Height = 1200;
    }
    else
    {
        winSize.Height = monitorInfo.NativeResolutionInRawPixels.Height;
        winSize.Width = monitorInfo.NativeResolutionInRawPixels.Width;

        var widthInInches = Convert.ToInt32( 8 * monitorInfo.RawDpiX ); 
        var heightInInches = Convert.ToInt32( 12 * monitorInfo.RawDpiY );

        winSize.Height = winSize.Height > heightInInches? 
                         heightInInches: winSize.Height;
        winSize.Width = winSize.Width > widthInInches ? widthInInches: winSize.Width;
    }

    appWindow.Resize( winSize );
}

Link

Windows.Graphics.RectInt32 rect = new()
{
    X = (displayArea.WorkArea.Width / 2) - (_wndWidth / 2),
    Y = (displayArea.WorkArea.Height / 3) - (_wndHeight / 2),
    Height = _wndHeight,
    Width = _wndWidth
};

_appWindow.MoveAndResize(rect, displayArea);
_appWindow.Show();
_appWindow.MoveInZOrderAtTop();

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.