728x90
반응형
728x170
▶ MainPage.xaml
<Page x:Class="TestProject.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
FontFamily="나눔고딕코딩"
FontSize="16">
<Grid>
<StackPanel
HorizontalAlignment="Center"
VerticalAlignment="Center"
Spacing="10">
<AppBarToggleButton Name="appBarToggleButton"
HorizontalAlignment="Center"
Label="모서리"
Click="appBarToggleButton_Click">
<AppBarToggleButton.Content>
<Viewbox>
<PathIcon Data="F 1 M 20 20 L 24 10 L 24 24 L 5 24" />
</Viewbox>
</AppBarToggleButton.Content>
</AppBarToggleButton>
<TextBlock Name="textBlock"
HorizontalAlignment="Center" />
</StackPanel>
</Grid>
</Page>
728x90
▶ MainPage.xaml.cs
using Windows.Foundation;
using Windows.Graphics.Display;
using Windows.UI.ViewManagement;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace TestProject
{
/// <summary>
/// 메인 페이지
/// </summary>
public sealed partial class MainPage : Page
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 생성자 - MainPage()
/// <summary>
/// 생성자
/// </summary>
public MainPage()
{
InitializeComponent();
#region 윈도우 크기를 설정한다.
double width = 800d;
double height = 600d;
double dpi = (double)DisplayInformation.GetForCurrentView().LogicalDpi;
ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize;
Size windowSize = new Size(width * 96d / dpi, height * 96d / dpi);
ApplicationView.PreferredLaunchViewSize = windowSize;
Window.Current.Activate();
ApplicationView.GetForCurrentView().TryResizeView(windowSize);
#endregion
#region 윈도우 제목을 설정한다.
ApplicationView.GetForCurrentView().Title = "AppBarToggleButton 엘리먼트 : Content 속성에서 PathIcon 객체 사용하기";
#endregion
}
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Method
////////////////////////////////////////////////////////////////////////////////////////// Private
#region 앱바 토글 버튼 클릭시 처리하기 - appBarToggleButton_Click(sender, e)
/// <summary>
/// 앱바 토글 버튼 클릭시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private void appBarToggleButton_Click(object sender, RoutedEventArgs e)
{
AppBarToggleButton button = sender as AppBarToggleButton;
if(button.IsChecked.GetValueOrDefault())
{
this.textBlock.Text = "버튼을 체크했습니다 : " + button.Label;
}
else
{
this.textBlock.Text = "버튼을 체크 취소했습니다 : " + button.Label;
}
}
#endregion
}
}
728x90
반응형
그리드형(광고전용)
'C# > UWP' 카테고리의 다른 글
[C#/UWP] MenuBar 엘리먼트 : 하위 메뉴, 분리자, 라디오 항목 사용하기 (0) | 2021.07.09 |
---|---|
[C#/UWP] MenuBar 엘리먼트 : 메뉴에서 키보드 가속기 사용하기 (0) | 2021.07.09 |
[C#/UWP] MenuBar 엘리먼트 사용하기 (0) | 2021.07.09 |
[C#/UWP] CommandBar 엘리먼트 사용하기 (0) | 2021.07.08 |
[C#/UWP] AppBarToggleButton 엘리먼트 : Style 속성 사용하기 (0) | 2021.07.08 |
[C#/UWP] AppBarToggleButton 엘리먼트 : Icon 속성에서 FontIcon 객체 사용하기 (0) | 2021.07.08 |
[C#/UWP] AppBarToggleButton 엘리먼트 : Icon 속성에서 BitmapIcon 객체 사용하기 (0) | 2021.07.08 |
[C#/UWP] AppBarToggleButton 엘리먼트 : Icon 속성 사용하기 (0) | 2021.07.08 |
[C#/UWP] AppBarSeparator 엘리먼트 사용하기 (0) | 2021.07.07 |
[C#/UWP] AppBarButton 엘리먼트 : Style 속성 사용하기 (0) | 2021.07.07 |
댓글을 달아 주세요