2017-11-02 12 views
2

윈도우 컨트롤을 제목 표시 줄로 확장하고 클릭 할 수있는 간단한 방법이 있습니까?UWP의 제목 표시 줄에 버튼 확장하기

관련 게시물 (How to customize the application title bar for a UWP page)을 읽었으며 시각적으로 제목 표시 줄 영역으로 확장하는 방법을 알고 있습니다. 그러나 내 버튼은 해당 영역에서 클릭 할 수 없습니다 (레이어 위에 클릭하면 클릭되지 않습니다).

+1

직접 해보지 않았으므로 실제 답변으로 게시하지 마십시오.이 예는 도움이 될 수 있습니다. https://www.eternalcoding.com/?p=1952 – Depechie

답변

2

물론 것, 당신은 거기에서

//draw into the title bar 
CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true; 

//remove the solid-colored backgrounds behind the caption controls and system back button 
ApplicationViewTitleBar titleBar = ApplicationView.GetForCurrentView().TitleBar; 
titleBar.ButtonBackgroundColor = Colors.Transparent; 
titleBar.ButtonInactiveBackgroundColor = Colors.Transparent; 

와 함께, 오른쪽 공간에 버튼을 배치의 문제가 될 것 시작한다.

앱 제목을 제거되기 때문에이 또한 도움이 될 것입니다 :

<!-- Page attribute --> 
xmlns:appmodel="using:Windows.ApplicationModel" 

<TextBlock x:Name="AppTitle" Style="{StaticResource CaptionTextBlockStyle}" 
    Text="{x:Bind appmodel:Package.Current.DisplayName}" IsHitTestVisible="False"/> 

그리고, 물론, 당신은 뒤로 버튼

CoreApplicationViewTitleBar titleBar = CoreApplication.GetCurrentView().TitleBar; 
titleBar.LayoutMetricsChanged += TitleBar_LayoutMetricsChanged; 

private void TitleBar_LayoutMetricsChanged(CoreApplicationViewTitleBar sender, object args) 
{ 
    AppTitle.Margin = new Thickness(CoreApplication.GetCurrentView().TitleBar.SystemOverlayLeftInset + 12, 8, 0, 0); 
} 

행운을 빕니다에주의 할 것 !

+0

기타 : https://docs.microsoft. .com/en-us/windows/uwp/style/title-bar –