我試圖找到一種方法來從代碼啟動(dòng)關(guān)閉活動(dòng)的 DialogHost,但一直無法找到正確的語法。我認(rèn)為主要的挑戰(zhàn)是從背后的 MainWindow 代碼之外的類訪問 DialogHost。我的 XAML 的全部內(nèi)容:<Window x:Class="MaterialDesignTest.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:MaterialDesignTest" mc:Ignorable="d" Title="MainWindow" Height="350" Width="525" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" TextElement.Foreground="{DynamicResource MaterialDesignBody}" TextElement.FontWeight="Regular" TextElement.FontSize="13" TextOptions.TextFormattingMode="Ideal" TextOptions.TextRenderingMode="Auto" Background="{DynamicResource MaterialDesignPaper}" FontFamily="{DynamicResource MaterialDesignFont}">
2 回答

HUWWW
TA貢獻(xiàn)1874條經(jīng)驗(yàn) 獲得超12個(gè)贊
我已經(jīng)嘗試了您的解決方案,但是沒有用。另一方面,我找到了修復(fù)它的方法:
var drawer = DrawerHost.CloseDrawerCommand; drawer.Execute(null, null);
它看起來一樣,但對(duì)我有用。
- 2 回答
- 0 關(guān)注
- 644 瀏覽
添加回答
舉報(bào)
0/150
提交
取消