为什么ToolKit-ListPicker被卡住了?

时间:2014-09-10 04:21:55

标签: c# windows-phone-7 windows-phone-8 toolkit windows-phone-toolkit

我一直使用 Toolkit-Windows Phone 8作为组合框选项选择控件,但是我在某些时候经历过列表选择器控件未关闭其弹出窗口(全屏)主要是模式)。由于列表选择器处理后退按键事件,因此它无法使用该应用程序。此外,如果您已经处理了应用程序简历,那么您将被困在此窗口,我已经检查了应用程序导航到的URL应用程序。然后我从RootFrame_Navigating Method找到了以下网址。

Microsoft.Phone.Controls.Toolkit;组件/ ListPicker / ListPickerPage.xaml

此外,我试图重新创建此错误,我发现有时无法重新生成。因此,我想知道有人遇到此错误,这将是什么解决方案? 感谢

enter image description here

与Listpicker相关的代码

<toolkit:ListPicker x:Name="cmbinvoice"  
                                            ItemsSource="{Binding Path=listinvoices}"                                              
                                            Grid.Column ="0" 
                                            Grid.ColumnSpan="2"   
                                            RenderTransformOrigin="0.5,0.5" 
                                            ExpansionMode="FullscreenOnly" 
                                            Foreground="Black" 
                                            Background="White"  
                            FullModeHeader="Invoice"
                                            Margin="15,90,10,-123" FontWeight="Bold" TabIndex="2147483645" Tag="" SelectionChanged="cmbinvoice_SelectionChanged"    >
                <toolkit:ListPicker.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding invoiceno}" />
                    </DataTemplate>
                </toolkit:ListPicker.ItemTemplate>
                <toolkit:ListPicker.FullModeItemTemplate>
                    <DataTemplate>
                        <StackPanel Margin="16 15 0 15"  Orientation="Horizontal" >
                            <TextBlock Text="{Binding invoiceno}"
                                       Margin="0 0 0 0"
                                       FontSize="30" 
                                       FontFamily="{StaticResource PhoneFontFamilyLight}"/>
                        </StackPanel>
                    </DataTemplate>
                </toolkit:ListPicker.FullModeItemTemplate>
            </toolkit:ListPicker>

代码背后

     cmbinvoice.ItemsSource = vm.invoiceh; //When the Page Starts 

private void cmbinvoice_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            invoiceno = "";
            vm.invoiced.Clear();
            vm.invoicep.Clear();
            if (cmbinvoice.SelectedIndex != -1 && vm.invoiceh[cmbinvoice.SelectedIndex].invoiceno != "Select One")
            {
                invoiceno = vm.invoiceh[cmbinvoice.SelectedIndex].invoiceno;
                vm.cancelphase2setup(invoiceno);
                invpayments.ItemsSource = vm.invoicep;
                invitems.ItemsSource = vm.invoiced;
                lblcustomer.Text = vm.invoiceh[cmbinvoice.SelectedIndex].customer;
                lbltotal.Text = vm.invoiceh[cmbinvoice.SelectedIndex].amount.ToString("N2");
                lbldate.Text = string.Format("{0:dd-MMM-yyyy}", vm.invoiceh[cmbinvoice.SelectedIndex].invoicedate.Date);
            }
            else
            {
                lbldate.Text = "";
                lbltotal.Text = "";
                lblcustomer.Text = "";
            }
        }

ViewModel代码

页面开始时

public void cancelsetup()
        {
            int customer = APPCommon.customerid;
            //var query = from InvoiceHeader oh in APPCommon.SFADB where oh.CustomerID == customer && oh.Deleted == false && oh.InvoiceDate == APPCommon.TransactionDate select oh;

            invoiceh.Add(new InvHead() { customerid = 0, amount = 0, customer = "", invoicedate = APPCommon.TransactionDate, invoiceno = "Select One" });

            foreach (string x in APPCommon.invnos)
                foreach (InvoiceHeader oh in from InvoiceHeader oh in APPCommon.SFADB where oh.CustomerID == customer && oh.Deleted == false && oh.InvoiceDate == APPCommon.TransactionDate && oh.InvoiceNo == x orderby oh.InvoiceNo descending select oh)
                    if (!(from OutstandingSettlementsDetail O in APPCommon.SFADB where O.InvoiceNo == oh.InvoiceNo select O).Any())
                        invoiceh.Add(new InvHead() { customerid = oh.CustomerID, amount = oh.NetAmount, customer = APPCommon.CustomerName, invoicedate = oh.InvoiceDate, invoiceno = oh.InvoiceNo });
        }

选择Listpicker时

public void cancelphase2setup(string invoiceno)
        {
            if (invoiceno == "") return;

            foreach (InvoicePayment ip in from InvoicePayment ip in APPCommon.SFADB where ip.InvoiceNo == invoiceno select ip)
            {
                string pt = (from PaymentType p in APPCommon.SFADB where p.ID == ip.PaymentTypeID select p.Name).FirstOrDefault();
                invoicep.Add(new InvPayment() { Amount = ip.Amount, invoiceno = ip.InvoiceNo, invpaymentno = ip.InvoicePaymentNo, type = pt, typeid = ip.PaymentTypeID });
                pt = null;
            }

            foreach (InvoiceDetail id in from InvoiceDetail id in APPCommon.SFADB where id.InvoiceNo == invoiceno select id)
            {
                string im = (from ItemMaster i in APPCommon.SFADB where i.ID == id.ItemMasterID select i.Name).FirstOrDefault();
                invoiced.Add(new InvDetail() { BatchNo=id.BatchNo, DiscountPercentage = id.DiscountPerc, invoiceno = id.InvoiceNo, ItemMasterID = id.ItemMasterID, ItemMasterName = im, NBT = id.NBTPerc, Quantity = id.Qty, Total = id.NetAmount, UnitPrice = id.Price, VAT = id.VATPerc });
                im = null;
            }

            string key = (from ExchangeHeader e in APPCommon.SFADB where e.InvoiceNo == invoiceno select e.ExchangeNo).FirstOrDefault();

            if (key != null)
                foreach (var e in from ExchangeDetail e in APPCommon.SFADB where e.ExchangeNo == key select e)
                {
                    string im = (from ItemMaster i in APPCommon.SFADB where i.ID == e.ItemMasterID select i.Name).FirstOrDefault();
                    invoiced.Add(new InvDetail() { exchange = true, rtn = false, BatchNo = e.BatchNo, DiscountPercentage = 0, invoiceno = invoiceno, ItemMasterID = e.ItemMasterID, ItemMasterName = im, NBT = 0, Quantity = (double)e.Qty, Total = (decimal)e.NetAmount, UnitPrice = (decimal)e.UnitPrice, VAT = 0 });
                    im = null;
                }

            key = (from ReturnHeader e in APPCommon.SFADB where e.InvoiceNo == invoiceno select e.ReturnNo).FirstOrDefault();

            if (key != null)
                foreach (var e in from ReturnDetail e in APPCommon.SFADB where e.ReturnNo == key select e)
                {
                    string im = (from ItemMaster i in APPCommon.SFADB where i.ID == e.ItemMasterID select i.Name).FirstOrDefault();
                    invoiced.Add(new InvDetail() { exchange = false, rtn = true, BatchNo = e.BatchNo, DiscountPercentage = 0, invoiceno = invoiceno, ItemMasterID = e.ItemMasterID, ItemMasterName = im, NBT = 0, Quantity = (double)e.Qty, Total = (decimal)e.NetAmount, UnitPrice = (decimal)e.Price, VAT = 0 });
                    im = null;
                }
        }

1 个答案:

答案 0 :(得分:0)

工具包出错,除非您是开发人员,否则无法修复。