Giter Club home page Giter Club logo

Comments (7)

github-actions avatar github-actions commented on June 25, 2024

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

from maui.

PureWeen avatar PureWeen commented on June 25, 2024

Here's some info on how to customize the titlebar

#20976 (comment)

from maui.

bdovaz avatar bdovaz commented on June 25, 2024

Here's some info on how to customize the titlebar

#20976 (comment)

@PureWeen I tried that but the following happens to me:

<DataTemplate x:Key="MauiAppTitleBarTemplate">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        <TextBlock VerticalAlignment="Center" Text="MyText" />
        <TextBlock VerticalAlignment="Center" Grid.Column="2" Text="MyText2" />
    </Grid>
</DataTemplate>

Output (as you can see, on the right side it overlaps with the buttons of the window):

(AppShell.xaml -> Shell.FlyoutBehavior="Disabled")

image

(AppShell.xaml -> Shell.FlyoutBehavior="Flyout")

image

As you can see, even using this method I can't get it to work.

Besides, what you have not answered me is why SetTitleBar doesn't work, is it a MAUI bug? Am I doing something wrong? Because my idea was to follow the "Full customization" tutorial since I want the title bar to be interactive:

https://learn.microsoft.com/en-us/windows/apps/develop/title-bar#full-customization

from maui.

drasticactions avatar drasticactions commented on June 25, 2024

I agree that what @PureWeen sent doesn't address your issue directly, but I don't think that "SetTitleBar" doesn't work, it's that you're not using it right, but you also couldn't because the way MAUI apps work. I'll try to explain my thought process.

  • First, your example code is wrong. If you're building a WinUI app, you would need to pass in a UIElement contained within the existing Window. You're passing in a new element (I don't know the type, since you didn't provide a sample) so it's not connected to anything, so it won't work no matter what.
  • So you would, generally, build a WinUI Window, create a UIElement within that Window to represent the TitleBar, then call SetTitleBar with that element. While you can create a new MAUI Window (which itself is a WinUI 3 Window, wrapped), you can't directly set elements contained within it, at least not easily.
  • What @PureWeen's example does show is that the TitleBar is already abstracted within MAUI and you can add additional elements within that. however to the best of my knowledge, elements contained within this TitleBar can't be interactive, apart from the hamburger menu on the left nav, because you would need further customization to allow buttons, etc, to be clickable.

So TL;DR

  • SetTitleBar does work if you pass in a UIElement...
  • But passing in a valid UIElement isn't trivial unless you hack underlying implementations of frameworks...
  • But there is a TitleBar you can customize through the Platform XAML...
  • But you probably can't add the elements you want to make it interactive without also hacking more of the window...

IMO, you would be better off using MAUI Native Embedding and creating a WinUI 3 app that contains MAUI Elements instead. That would give you full control of the WinUI 3 window without needing to deal with all of that overhead. I have an example of this here that could help you do it.

from maui.

PureWeen avatar PureWeen commented on June 25, 2024

You can set interactive regions here

Rect[] IWindow.TitleBarDragRectangles
{
get
{
return (this.Handler as IWindowHandler)?.PlatformView?
.GetDefaultTitleBarDragRectangles(this.GetCurrentlyPresentedMauiContext());
}
}

from maui.

dotnet-policy-service avatar dotnet-policy-service commented on June 25, 2024

Hi @bdovaz. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

from maui.

dotnet-policy-service avatar dotnet-policy-service commented on June 25, 2024

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.

from maui.

Related Issues (20)

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.