2

我的问题就是这样。我应该如何显示 Callisto 工具包中的 CustomDialog 控件?我有以下 xaml:

<controls:LayoutAwarePage
x:Name="pageRoot"
x:Class="HeronClientWindowsStore.Views.SuggestEventDialogPage"
DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:HeronClientWindowsStore.Views"
xmlns:controls="using:HeronClientWindowsStore.Controls"
xmlns:callisto="using:Callisto.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

<Page.Resources>
</Page.Resources>

<callisto:CustomDialog 
                     x:FieldModifier="public" 
                     x:Name="suggestEventDialog" 
                     Width="300" Height="500"
                     Title="Suggest an Event" 
                     Background="Teal" 
                     BackButtonVisibility="Visible">
    <StackPanel>
        <TextBlock 
                  Margin="0,0,0,8" 
                  Text="Suggest an event that should be added to Heron."
                  FontSize="14.6667" 
                  FontWeight="SemiLight" 
                  TextWrapping="Wrap" />
        <TextBlock
                  Margin="0,0,0,8"
                  FontSize="14.6667" 
                  FontWeight="SemiLight" 
                  Text="Event URL" />
        <callisto:WatermarkTextBox 
                  HorizontalAlignment="Left" 
                  Watermark="http://www.example.com" 
                  Width="400" 
                  Height="35" />
        <StackPanel 
                  Margin="0,20,0,0" 
                  HorizontalAlignment="Right" 
                  Orientation="Horizontal">
            <Button Content="OK" Width="90" Margin="0,0,20,0" />
            <Button Content="CANCEL" Width="90" />
        </StackPanel>
    </StackPanel>
</callisto:CustomDialog>

它没有显示,我看不到任何触发它的方法。

4

1 回答 1

3

您必须使用IsOpen属性来打开对话框。

我在这里粘贴我的工作代码。

XAML

<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
    <Button Content="Show Dialog" Click="btnShowDialog_Click" />
    <callisto:CustomDialog 
                 x:FieldModifier="public" 
                 x:Name="suggestEventDialog" 
                 Title="Suggest an Event" 
                 Background="Teal" 
                 BackButtonVisibility="Visible"
                 BackButtonClicked="suggestEventDialog_BackButtonClicked_1">
        <StackPanel>
            <TextBlock 
              Margin="0,0,0,8" 
              Text="Suggest an event that should be added to Heron."
              FontSize="14.6667" 
              FontWeight="SemiLight" 
              TextWrapping="Wrap" />
            <TextBlock
              Margin="0,0,0,8"
              FontSize="14.6667" 
              FontWeight="SemiLight" 
              Text="Event URL" />
            <callisto:WatermarkTextBox 
              HorizontalAlignment="Left" 
              Watermark="http://www.example.com" 
              Width="400" 
              Height="35" />
            <StackPanel 
              Margin="0,20,0,0" 
              HorizontalAlignment="Right" 
              Orientation="Horizontal">
                <Button Content="OK" Width="90" Margin="0,0,20,0" />
                <Button Content="CANCEL" Width="90" />
            </StackPanel>
        </StackPanel>
    </callisto:CustomDialog>
</Grid>

C#

private void btnShowDialog_Click(object sender, RoutedEventArgs e)
{
    suggestEventDialog.IsOpen = true;
}

private void suggestEventDialog_BackButtonClicked_1(object sender, RoutedEventArgs e)
{
    suggestEventDialog.IsOpen = false;
}
于 2013-04-09T04:55:16.680 回答