首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Callisto CustomDialog等待响应

使用Callisto CustomDialog等待响应
EN

Stack Overflow用户
提问于 2014-06-30 04:06:39
回答 1查看 286关注 0票数 0

我有一个Windows应用程序,它使用Callisto工具包和CustomDialog控件

在FOREACH中,我显示了CustomDialog。问题是,我需要等待用户的响应,我的意思是,等待点击的按钮事件(按钮1或按钮2)。

使用MessageDialog很容易,您只需要等待dialog.ShowAsync();

代码语言:javascript
复制
<callisto:CustomDialog x:FieldModifier="public" x:Name="JustATest" 
    Background="White" BackButtonVisibility="Collapsed" Title="Some title">
    <StackPanel Width="500">
        <TextBlock Margin="0,0,0,8" FontSize="14.6667" FontWeight="SemiLight" TextWrapping="Wrap">
            <Run x:Name="txt1" Text="Some random sample text.."/>
        </TextBlock>
        <CheckBox Margin="0,20,0,8" Content="Some checkbox" />

        <StackPanel Margin="0,20,0,0" HorizontalAlignment="Right" Orientation="Horizontal">
            <Button Content="button 1" Width="80" Margin="0,0,20,0" />
            <Button Content="button 2" Width="80" />
        </StackPanel>
    </StackPanel>
</callisto:CustomDialog>
EN

回答 1

Stack Overflow用户

发布于 2014-07-17 05:26:26

1) WinRT XAML工具包 - AsyncUI库

2) using WinRTXamlToolkit.AwaitableUI;

3) public async Task<bool> ShowDialogAsync(....) { ....... this.Dialog.IsOpen = true; //add buttons to awaitable var buttons = new List<ButtonBase>(); buttons.Add(btnOK); buttons.Add(btnCancel); //wait for result var clickedButton = await buttons.WaitForClickAsync(); //close popup this.Dialog.IsOpen = false; ....... //return result return clickedButton.Name.Contains("btnOK"); }

4) var result = await ShowDialogAsync();

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24482805

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档