Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WPF] UserControl doesn't fill the DeskBand #51

Closed
kevinglier opened this issue Mar 3, 2020 · 2 comments
Closed

[WPF] UserControl doesn't fill the DeskBand #51

kevinglier opened this issue Mar 3, 2020 · 2 comments

Comments

@kevinglier
Copy link

kevinglier commented Mar 3, 2020

Hey,

I really like this project, especially its WPF-Example. When I set the MinWidth, I get DeskBand with the Size I need.

But there's a problem: The UserControl isn't correctly sized to the bounds of its parent. Is there a way to achieve this? I already tried to modify the CSDeskBand.cs, but that didn't do anything:

public IntPtr Handle
{
    get
    {
        if (_rootVisual.Child == null)
        {
            _rootVisual.Child = UIElement;
            _rootVisual.Child.ClipToBounds = true;
            _rootVisual.ClipToBounds = true;
        }

        return HwndSource.Handle;
    }
}

Do you have any other ideas?

@kevinglier
Copy link
Author

kevinglier commented Mar 3, 2020

Okay, I think I found a way by myself. The answer #25 (comment) was helping me here. I think by using the overrides, it should crash at the next restart.

protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)
{
    base.OnRenderSizeChanged(sizeInfo);
    SetHeightTo100Percent();
}

protected override void OnInitialized(EventArgs e)
{
    base.OnInitialized(e);
    SetHeightTo100Percent();
}

private void SetHeightTo100Percent()
{
    Height = SystemParameters.PrimaryScreenHeight - SystemParameters.WorkArea.Height;
}

@srwi
Copy link

srwi commented Sep 14, 2020

In my opinion a better fix is described in #46 which fixes this for vertical and horizontal taskbars.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants