1 Replies - 1317 Views - Last Post: 04 October 2010 - 03:19 AM Rate Topic: -----

#1 rocky_upadhaya  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 52
  • Joined: 09-January 10

Xaml and Gui Crashes without any apparent reason.

Posted 04 October 2010 - 01:33 AM

Hi there;

I had this same project attached in the other DIC forum Post also but for the different problem. Thanks to @Core and @eclipsed4utoo I got that problem solved. I successfully binded the database column as the item of the column also and everything is working well also, no error is thrown while building also but the GUI part ie Window1.xaml crashes.
Below is the error message thrown while i try to open the Window1.xaml. Can anyone out here have faced the similar problem or have any idea in solving this problem??
Could not create an instance of type 'NameList'.


Is This A Good Question/Topic? 0
  • +

Replies To: Xaml and Gui Crashes without any apparent reason.

#2 ragingben  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 177
  • View blog
  • Posts: 645
  • Joined: 07-October 08

Re: Xaml and Gui Crashes without any apparent reason.

Posted 04 October 2010 - 03:19 AM

If I remove the XAML
<local:NameList x:Key="NameListData"/>
(and then obviously the reference
ItemsSource="{Binding Source={StaticResource NameListData}}"
from your Window1.xaml file, then add the line
NameList list = new NameList();
to your Window1 constructor, and then put a breakpoint on it, I can step through to the line
foreach (var lol in newlikes.Likes)
which is in your NameList constructor:
public class NameList : ObservableCollection<PersonName>
     private LikesLINQDataContext newlikes = new LikesLINQDataContext();

    List<string> depart = new List<string>();
    public NameList(): base()

        foreach (var lol in newlikes.Likes)

        foreach (string lol1 in depart)
            Add(new PersonName(lol1));


The error I get is


"The file \"PATH\Testme.mdf\" is on a network path that is not supported for database files.\r\nAn attempt to attach an auto-named database for file PATH\Testme.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share."
. I'm at work at the moment, so all files have to be on the network.

So with that in mind, I moved the project to my c drive, and defined the NameList in xaml on window1, and bound to the static resource just like you did, and it worked fine - well the animals came up in the combo box anyway.

So I guess you should check where you are running the code from, and I'm not to sure how this works, but you should check the permissions for the data base to ensure that you are allowed to access it if your on a network.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1