Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6037535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:05:19+00:00 2026-05-23T06:05:19+00:00

I am learning expression blend using the following link http://visitmix.com/labs/rosetta/EyesOfBlend/DataTemplates/ It is a very

  • 0

I am learning expression blend using the following link http://visitmix.com/labs/rosetta/EyesOfBlend/DataTemplates/
It is a very good step by step instruction on using expression blend. I was able to do all the steps successfully and I was able to run the program and got the final result.

Right after step (9), before running the project, when I checked the designer, the designer did not show the image in the big image control I have added in step (9). I knew why, since the selected index of the ListBox was -1, so I changed the selectedindex to 0, now I was able to see the image. But when I compiled the code I get the following error

“Specified argument was out of the range of valid values. Parameter name:SelectedIndex”

XAML is

<Grid x:Name="LayoutRoot" Background="White" DataContext="{Binding Source={StaticResource SampleDataSource}}">
    <Grid x:Name="itemGrid" DataContext="{Binding SelectedItem, ElementName=listBox}">
        <Image Margin="185,56,153,160" Stretch="Fill" Source="{Binding Name}"/>
    </Grid>
    <ListBox x:Name="listBox" SelectedIndex="0" Margin="8,0,0,8" ItemsSource="{Binding Collection}" ItemTemplate="{StaticResource ItemTemplate1}" ItemsPanel="{StaticResource ItemsPanelTemplate1}" Height="101" VerticalAlignment="Bottom"/>
</Grid>

If I remove the selected index, all compile good. Could someone explain why it showed first time after compiling, it stopped working?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T06:05:19+00:00Added an answer on May 23, 2026 at 6:05 am

    You are almost always better binding to the SelectedItem than the SelectedIndex. If the Item is null, the binding should fail gracefully.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been learning WPF and checking out Expression Blend. As far as I can
Hi Can anyone suggest the best video tutorials for learning expression blend? Thanks Judi
I am learning lambda expression and delegates.While i try to execute the following ,I
I m just learning regular expression matching using javascript, and have a doubt regarding
Learning xml, Can anyone help me? I have following XML code: **<book lang=en>name of
I'm learning WPF and started with this MSDN tutorial. I was just following the
I am in my first few days of Regular Expression learning. I am trying
I'm stil pretty new to regular expression and just started learning to use awk.
This regular expression is for a MySQL query. I want to exclude the following
Learning rails and something smells a little funny. I have the following form for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.