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#:
<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 = "/Territory.xaml?id=" + 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);
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)