JuHwon
JuHwon

Reputation: 2063

WinRT - Value does not fall within the expected range

I have to make a MetroApp Frontend in C#.

I have an OverviewPage where i got a GridView with a Preview of the Detail Page. I discribed it more detailed and with screenshot in the following thread: WinRT XamlControl Preview Image

I get the Content-Panel which i display in the DetailPage from an external library.

Because i want a Preview of the DetailPage in my OverviewItems i have to show the same Panel in my GridView Items.

When i click on an Item it navigates me to the DetailPage and i get the following error when i try to add the Panel to my DetailPage: Value does not fall within the expected range.

I think this is because i got already a Panel with equal names in my VisualTree?! Is this assumption right? The Panel contains a Canvas with some xaml elements and onclick-Event-triggers on it btw.

What can i do to fix this bug? I dont know how to continue.. :/

If you need more information - just ask please.

Upvotes: 3

Views: 2362

Answers (1)

Filip Skakun
Filip Skakun

Reputation: 31724

You can't use the same instance of an element in multiple places in the app, so if an instance is already somewhere in the visual tree - you can't also add it elsewhere. I don't think duplicate names are a problem unless they are in the same name scope and if they were you would probably fail at build time.

Upvotes: 5

Related Questions