Comments (7)
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:
- Not able to change title bar color in MAUI UWP (#19252), similarity score: 0.72
Closed similar issues:
- Net Maui Windows Titlebar color is not working as expected (#19709), similarity score: 0.79
- Unable to hide title bar fron window with blazor hybrid on Windows (#17181), similarity score: 0.76
- Custom Title Bar Colors not working after migrating to .NET 8 (#19787), similarity score: 0.73
- Title bar still not behaving correctly... (#7123), similarity score: 0.73
Note: You can give me feedback by thumbs upping or thumbs downing this comment.
from maui.
Here's some info on how to customize the titlebar
from maui.
Here's some info on how to customize the titlebar
@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")
(AppShell.xaml -> Shell.FlyoutBehavior="Flyout")
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.
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 existingWindow
. 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.
You can set interactive regions here
maui/src/Controls/src/Core/Window/Window.Windows.cs
Lines 27 to 34 in b183cae
from maui.
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.
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)
- Invalid Xaml "sys:DateTime". HOT 1
- Application.Current?.Quit() cannot close all windows in Win Platform HOT 1
- WinRT.Runtime exception on async file writing HOT 4
- Android项目ToolbarItem改变可用状态后字体颜色异常 HOT 4
- [Windows] Keyboard focus does not shift to a newly opened modal page: Pressing enter clicks the button on the page beneath the modal page HOT 2
- Android exception on HTTPClient post MultipartFormDataContent (to upload a photo) - "unable to convert instance of type 'java.net.urlconnectioninvoker' to type 'java.net.httpurlconnection'" HOT 3
- MacCatalyst build on mac results in "Unknown Scheme", but iOS build working fine. HOT 4
- Voice over is not announcing the hint as press control option space begin editing for Ingredients, Recipe, Review edit fields: A11y_.NET Core_Recipes App My Recipes New_New Recipe_screeReader HOT 1
- The target "StaticWebAssetsPrepareForRun" does not exist in the project. HOT 1
- {Binding .} doesn't work in release mode HOT 3
- Editor and ScrollView problems in iOS HOT 2
- Edit box outline is not visible for Ingredients, Recipe, Review edit field: A11y_.NET Core_Recipes App My Recipes New_New Recipe_Usability HOT 1
- Clicking on a button nested inside a Grid that hovers fixed above a CollectionView does not trigger any Events or Commands HOT 3
- iOS: CollectionView Crashes when clearing ObservableCollection & adding data second time onwards HOT 4
- In .NET 8 IOS platform getting exception while remove the child from the current layout. HOT 1
- [Windows] `Controls.Sample.Sandbox` cannot be compiled with `PublishReadyToRun=True` HOT 1
- [Android]: Picker control's underline below the title doesn't respect forced light mode HOT 3
- [Windows] GroupedItemTemplateCollection CollectionChanged event not unsubscribed, causes memory leak. HOT 4
- CollectionView is slow to initialize with complex ItemTemplate HOT 2
- Enumerating contacts retrieved by GetAllAsync traps HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from maui.