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 8942453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:31:16+00:00 2026-06-15T11:31:16+00:00

NET C# , In my windows phone 7.5 application , I want to make

  • 0

NET C# ,
In my windows phone 7.5 application , I want to make visible the application bar if any item has selected .. So I am making it visible in selected change event. But what is happening in my code is when ever selection change it also triggers LostFocus event and in that event I am making selected index = 0.
Now the resultant of the code is when ever I select any item , application bar gets visible then automatically invisible ( because of lost focus event).
Following is the piece of code .

 private void ShopingListItemDetails_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
        if (ShopingListItemDetails.SelectedIndex != -1)
        {
            ApplicationBar.IsVisible = true;
            int selind = ShopingListItemDetails.SelectedIndex;
        }
    }

    private void ShopingListItemDetails_LostFocus(object sender, RoutedEventArgs e)
    {

        ApplicationBar.IsVisible = false;
        ShopingListItemDetails.SelectedIndex = -1;
    }

I am just at start with .NET C#(XAML) so assuming that selection change event is also triggering LostFocus event.

Please help me what is the real problem behind.Thanks
Zauk

  • 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-06-15T11:31:18+00:00Added an answer on June 15, 2026 at 11:31 am

    You can use the following hack. Initialize a variable, say selectChanged to False initially in the xaml.cs. In SelectionChanged function change it to True. Now, in the LostFocus function do processing only if the selectChanged variable is false, and if it is true set it back to False

    Boolean selectChanged=false;
    private void ShopingListItemDetails_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
        if (ShopingListItemDetails.SelectedIndex != -1)
        {
            ApplicationBar.IsVisible = true;
            int selind = ShopingListItemDetails.SelectedIndex;
            selectChanged=true;
        }
    }
    
    private void ShopingListItemDetails_LostFocus(object sender, RoutedEventArgs e)
    {
        if(!selectChanged) 
        {
            ApplicationBar.IsVisible = false;
            ShopingListItemDetails.SelectedIndex = -1;
        }
        selectChanged=false;
    }
    

    I think this should solve your problem.

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

Sidebar

Related Questions

net to make a Windows Phone application. I have a listBox on page1 called
I use json-rpc client from json-rpc.net in my windows phone application. Code: var client
Can someone explain how to use JSON-RPC.net in my application for windows phone. When
I want to use gestures on a windows mobile phone. For example (using .net
I'm trying to make a basic client-server application for windows phone 7 (using Mango
I want to make a windows mobile 6 cellphone application. This application will talk
I want to write a DLNA controller application for my windows phone 7, that
I am developing a windows form application in .net c#, All I want to
I am writing an application in VB for windows phone 7.5 but it has
I want to do the below two tasks In Windows Phone 7 application. 1.Navigate

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.