본문 바로가기
Development/C#.NET

Change ContentDialog size

by 로젠크로와싱 2024. 1. 30.
반응형

ContentDialog size change code.

var dialog = new ContentDialog();
dialog.Title = "Size Changing";
dialog.CloseButtonText = "Close";
dialog.XamlRoot = this.XamlRoot;

dialog.Resources["ContentDialogMaxWidth"] = 548;    // Maximum Width - Possible.
dialog.Resources["ContentDialogMinWidth"] = 320;    // Minimal Width - Possible.
dialog.Resources["ContentDialogMaxHeight"] = 756;   // Maximum Height - Possible.
//dialog.Resources["ContentDialogMinHeight"] = 184; // Minimal Height - Impossible.

await dialog.ShowAsync();

Exception occurs when MinHeight is changed. 
/*
System.AccessViolationException
  HResult=0x80004003
  Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
  Source=
  StackTrace:
*/

반응형