Windows Template Studio(桌面中的Winui 3) - 自定义标题栏
我是新手,我正在尝试自定义该应用程序中的标题栏。我已经使用Windows Template Studio为(桌面中的Winui 3)C创建了一个导航视图项目。该应用不会创建mainwindow.xaml。
我已经浏览了 docs ,我已经编辑了app.xaml.cs将其延长到steptscontentIntotItleBar = true。这可以通过扩展内容区域并删除标题栏来起作用,但是我不知道我需要在哪里使用settitlebar,因为我没有mainwindow.xaml来设置UIELEMENT。
public partial class App : Application
{
public static Window MainWindow { get; set; } = new Window();
public App()
{
InitializeComponent();
UnhandledException += App_UnhandledException;
Ioc.Default.ConfigureServices(ConfigureServices());
}
private void App_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
}
protected override async void OnLaunched(LaunchActivatedEventArgs args)
{
base.OnLaunched(args);
var activationService = Ioc.Default.GetService<IActivationService>();
await activationService.ActivateAsync(args);
MainWindow.Title = "AppDisplayName".GetLocalized();
MainWindow.ExtendsContentIntoTitleBar = true;
}
该应用程序如何或何处设置uIELEMENT和settitlebar?
希望这一切都有意义。
使用: VS2019 Windows App SDK Windows模板工作室 Windows 10
Jake
I am a newbie and i am trying to customize the titlebar in the App. I have used Windows Template Studio to create a NavigationView Project for (winui 3 in Desktop) c#. The App does not create a MainWindow.xaml.
I've gone through the docs, which i have edited the app.xaml.cs to extendscontentintotitlebar = true. This works by extending the content area and removing the titlebar, but i don't know where i need to use settitlebar, since i don't have a mainwindow.xaml to set the UIelement.
public partial class App : Application
{
public static Window MainWindow { get; set; } = new Window();
public App()
{
InitializeComponent();
UnhandledException += App_UnhandledException;
Ioc.Default.ConfigureServices(ConfigureServices());
}
private void App_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
}
protected override async void OnLaunched(LaunchActivatedEventArgs args)
{
base.OnLaunched(args);
var activationService = Ioc.Default.GetService<IActivationService>();
await activationService.ActivateAsync(args);
MainWindow.Title = "AppDisplayName".GetLocalized();
MainWindow.ExtendsContentIntoTitleBar = true;
}
How or Where do i set the UIelement and settitlebar in code-behind for the App?
Hope this all makes sense.
Using:
VS2019
Windows App SDK
Windows Template Studio
Windows 10
Jake
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论