My application crashed when snapped with items in listviews

别说谁变了你拦得住时间么 提交于 2019-12-12 05:24:25

问题


So, im currently working on a project using C#/XAML for a Windows 8 Store App and I've encountred a problem.

When the user navigates to a Page a ListView with some Controls shows up. Then when the user decides to snap the page my application crashes and shows this:

In my IntelliTrace this shows up and I press an Exception.

It navigates me to this code.

     /// <summary>
    /// Implement this partial method to configure the service endpoint.
    /// </summary>
    /// <param name="serviceEndpoint">The endpoint to configure</param>
    /// <param name="clientCredentials">The client credentials</param>

    static partial void ConfigureEndpoint(System.ServiceModel.Description.ServiceEndpoint serviceEndpoint, System.ServiceModel.Description.ClientCredentials clientCredentials);

    public EmployeeAssisterClient() : 
            base(EmployeeAssisterClient.GetDefaultBinding(), EmployeeAssisterClient.GetDefaultEndpointAddress()) {
        this.Endpoint.Name = EndpointConfiguration.TimeLoggerEndPoint.ToString();
        ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
    }

I add the controls to the listview as follows:

            _timeReports = _timeReportDatabase.GetAll();

            foreach (var timeReport in _timeReports)
            {
                _invoicedControls.Add(new InvoicedControl(timeReport)
                    {
                        Customer = timeReport.CustomerName,
                        Date = timeReport.Date,
                        WorkedTime = timeReport.WorkedTime.ToString(),
                        InvoicedTime = timeReport.InvoicedTime.ToString()
                    });
            }

            TimeReportsListViewFillView.ItemsSource = _invoicedControls;
            TimeReportsListViewFullView.ItemsSource = _invoicedControls;
            TimeReportsListViewPortraitView.ItemsSource = _invoicedControls;
            TimeReportsListViewSnappedView.ItemsSource = _invoicedControls;

EDIT==============================================================================

This is the error wich is thrown

I turned off WCF debugging by typing "C:\Program Files\Microsoft Visual Studio 11.0\Common7\IDE\VsDiag_regwcf.exe -u" into the Cmd and it resolved 2/3 problems

This is the last error in my IntelliTrace:

What does this error mean? And does any1 have an idea how to fix this?


回答1:


Based on what you've shown, it's likely that you've used a generated page (from a template), then removed some of the Xaml inside of it, which is fine.

The thing that you likely haven't done is removed the references to those controls you removed from the storyboards of the VisualStateManager, specifically for the Snapped state.

Go to your page and check (generally at the bottom of) the Xaml for the "Snapped" VisualState, then check and see if any of the Storyboards have a TargetName of a control that you no longer have.



来源:https://stackoverflow.com/questions/16333352/my-application-crashed-when-snapped-with-items-in-listviews

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!