当前位置: 代码迷 >> Windows Mobile >> 有关windows phone有关问题
  详细解决方案

有关windows phone有关问题

热度:6776   发布时间:2013-02-26 00:00:00.0
有关windows phone问题!
要求进入程序之前,弹出一个对话框,显示给用户一些关于使用本程序的一些事项等等,要求用户点击【确定】或【取消】,如果用户点确定的话,正常进入程序,用户点取消,则直接退出程序。

想问一下,当用户点取消的时候,如何直接退出程序呢?
弹出的对话框是继承 UserControl 类的自定义的控件,因此用不到NavigationService.GoBack()方法,非常郁闷的啊!

请高手赐教,有没有什么更好的方法呢?

------解决方案--------------------------------------------------------
如果你非要这么做,你可以将 取消 的操作回调给 调用你这个控件的page.
我的意思是你在你的UserControl里注册一个事件(取消的时候触发),然后在你的page里订阅这个事件,让page做NavigationService.GoBack()这件事。
------解决方案--------------------------------------------------------
看看EVENT DELEgate吧,或者直接搜观察者模式。
------解决方案--------------------------------------------------------
试下这个吧。
XML code
        <ListBox x:Name="budgetTypeListBox" ItemsSource="{Binding}" Grid.Row="1" VerticalAlignment="Stretch" HorizontalAlignment="Center">            <ListBox.ItemTemplate>                <DataTemplate>                    <StackPanel>                        <TextBlock Margin="0,15,0,10" TextAlignment="Center" Text="{Binding BudgetTypeName}"></TextBlock>                        <Border HorizontalAlignment="Stretch" Height="3">                            <Border.Background>                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">                                    <GradientStop Color="#FF006A8B" Offset="0" />k                                    <GradientStop Color="#FFD2E3E9" Offset="0.647" />                                </LinearGradientBrush>                            </Border.Background>                        </Border>                    </StackPanel>                </DataTemplate>            </ListBox.ItemTemplate>        </ListBox>
------解决方案--------------------------------------------------------
WP的程序本身就不建议增加让用户点击退出应用的入口。
这是在设计指南中明确建议的。
楼主何必要为难自己呢?
------解决方案--------------------------------------------------------
一般,都是设计个异常,自动退出即可。
  相关解决方案