帮助手机上的Silverlight工具箱 [英] HELP ON Silverlight Toolbox for phone

查看:96
本文介绍了帮助手机上的Silverlight工具箱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我具有C#的中级经验,而我的公司(那里是新公司)正在尝试
进入移动领域,所以我想弄清楚如何使现有应用程序在WP7上正常工作

我在Codeplex的Silverlight工具包中使用了一些工具,但发现该论坛
在codeplex暂时不活动了,所以我决定在codeproject找你.

首先,我想知道我是否仍然可以使用Silverlight Toolkit-支持者表示怀疑,它可能会像Silverlight Toolbox一样继续出现或最终消失

第二,当我按下后退按钮时,我的longlistSelector控件提供了空引用,但是将控件更改为ListBox可以正常工作.

请告诉我我做错了什么,以及是否有替代Silverlight Toolbox的工具,或者我是否真的不需要它.我也知道Coding4Fun @codeplex.谢谢.

XAML:

I have intermediate experience in C# and my company (am new there) is trying
to go into Mobile, so I am to figure out how to make existing apps work on WP7

I have used some tools in the Silverlight Toolkit from Codeplex, but I discovered that the forum
at codeplex is not active for a while now, so I decide to come to you guy at codeproject.

first I will like to know if I can still use Silverlight Toolkit - am skeptic on the support maybe it''ll becontinued or end up like Silverlight Toolbox

Second my longlistSelector Control gives a null reference when I press the back button but changing the control to a ListBox works fine.

Please tell me what I am doing wrong and also if I have alternative to Silverlight Toolbox or if I really don''t need it. I know of Coding4Fun @codeplex too. Thank you.

XAML:

<toolkit:longlistselector x:name=""areaList"" removed=""Transparent"" isflatlist=""True"<br" mode="hold" xmlns:x="#unknown" xmlns:toolkit="#unknown" />                                       ItemTemplate="{StaticResource itemTemplate}" ListHeaderTemplate="{StaticResource listHeader}" ListFooterTemplate="{StaticResource listFooter}" SelectionChanged="List_SelectionChanged" />


>


C#:


>


C#:

<pre lang="cs">private void List_SelectionChanged(object sender, SelectionChangedEventArgs e)
       {
           if (areaList.SelectedItem == null)
               return;
           var listbox = (ListBox)sender;
           var entry = (AreaModel)listbox.SelectedItem;
           var uri = &quot;/Territory.xaml?id=&quot; + entry.AREA_KEY;
           NavigationService.Navigate(new Uri(uri, UriKind.Relative));
           areaList.SelectedItem = null;
       }









protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
       {
           string selectedIndex = "";
           if (NavigationContext.QueryString.TryGetValue("id", out selectedIndex))
           {
               int index = int.Parse(selectedIndex);
               string strSelect = "SELECT AREA_KEY,AREA_NAME FROM AREA WHERE REGION_SK = " + index.ToString();
               _area = (Application.Current as App).db.SelectList<AreaModel>(strSelect);
               //PageTitle.Text +=
               areaList.ItemsSource = _area;
           }



这里是例外的详细信息:



HERE IS THE EXCEPTION DETAIL :

System.NullReferenceException was unhandled
  Message=NullReferenceException
  StackTrace:
       at Microsoft.Phone.Controls.LongListSelector.Balance()
       at Microsoft.Phone.Controls.LongListSelector.LongListSelector_LayoutUpdated(Object sender, EventArgs e)
       at System.Windows.FrameworkElement.OnLayoutUpdated(Object sender, EventArgs e)
       at MS.Internal.JoltHelper.RaiseEvent(IntPtr target, UInt32 eventId, IntPtr coreEventArgs, UInt32 eventArgsTypeIndex)

推荐答案

首先,我会这样做:

well first, I would do this:

if (_area != null)



在尝试将其用于任何用途之前.

其次,设置调试器设置,该设置允许您追溯到框架代码,以便可以看到LongListSelector.Balance()方法要执行的操作.这可能会引导您解决代码中的问题.

一个简单的谷歌搜索"longlistselector.balance"揭示了这一点:

http://mikaelkoskinen.net/post/wp7-longlist-selector-problems- and-fixing-them.aspx [ ^ ]



before trying to use it for anything.

Second, set the debugger setting that allows you to trace into the framework code so you can see what the LongListSelector.Balance() method is trying to do. That might steer you towards solving the problem in your code.

A simple google search for "longlistselector.balance" revealed this:

http://mikaelkoskinen.net/post/wp7-longlist-selector-problems-and-fixing-them.aspx[^]


这篇关于帮助手机上的Silverlight工具箱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆