繁体   English   中英

如何在列表框上放置一个弹出控件

[英]How to Place a Popup Control Over a ListBox

满足特定条件后,我想在列表框上放置一个弹出窗口。 当我在下面的代码中执行此操作时,我在页面构造函数中的InitializeComponent()上收到了XamlParseException 我不确定为什么吗?

EditPage.xaml

<Grid>
    <ListBox Name="ListBoxEffects" SelectionMode="Single" ItemsSource="{Binding}" Margin="{Binding}" toolkit:TiltEffect.IsTiltEnabled="True" SelectionChanged="ListBox_SelectionChanged" >
        <ListBox.ItemsPanel>
            <ItemsPanelTemplate>
                 <toolkit:WrapPanel ItemWidth="146" />
            </ItemsPanelTemplate>
        </ListBox.ItemsPanel>
        <ListBox.ItemTemplate>
             <DataTemplate>
                 <StackPanel Orientation="Vertical" Margin="12,0,0,24" >
                     <Image Source="{Binding Thumbnail}" Width="134" Height="134" />
                     <TextBlock Text="{Binding Name}" TextWrapping="Wrap" FontSize="{StaticResource PhoneFontSizeNormal}" VerticalAlignment="Center" HorizontalAlignment="Center" />
                  </StackPanel>
              </DataTemplate>
         </ListBox.ItemTemplate>
    </ListBox>
    <Popup x:Name="trialPopup">
        <Border Margin="3" BorderBrush="{StaticResource PhoneForegroundBrush}">
            <StackPanel Background="FF1BA1E2">
                 <TextBlock Text="Do you wish to purchase the application?" TextWrapping="Wrap"/>
                 <StackPanel Orientation="Horizontal" Margin="0,10">
                     <Button x:Name="purchaseButton" Content="purchase" Click="popupButton_Click"/>
                     <Button x:Name="cancelButton" Content="cancel" Click="popupButton_Click"/>
                 </StackPanel>
             </StackPanel>
         </Border>
     </Popup>
</Grid>

出于测试目的,我只是试图在导航到EditPage时立即显示弹出窗口,所以我可以看到它的外观和主题背景,但是在生产中,只有在满足特定要求后才会显示该弹出窗口。 我实际上如何测试在ListBox上看到的弹出窗口?

正如See Sharp在评论中提到的,问题在于以下几行:

<StackPanel Background="FF1BA1E2">

哈希符号(或数字符号)必须用作十六进制颜色的前缀:

<StackPanel Background="#FF1BA1E2">


另请参阅此相关答案以获取更多详细信息: https : //stackoverflow.com/a/1484842/247257

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM