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

  • Home
  • SEARCH
  • 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 6210731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:12:45+00:00 2026-05-24T06:12:45+00:00

The longlistselector control appears to be just what I need for my application as

  • 0

The longlistselector control appears to be just what I need for my application as I have a very long list that I need to display and I like the grouping features that it implements, but I’m really struggling with the databinding aspect of working with it. It took a while to get the basic databinding working, but I have that fully functional. If an item is removed or added the UI updates properly because the datasource derives from ObservableCollection.

The problem that I am having is that I have a flag in the individual dataitems that I am binding to that indicates if an individual list item should display or hide a graphic. The idea is that when the user performs a hold gesture on an item it will toggle the graphic on or off based on changes to the bound item’s properties.

    Visibility="{Binding Converter={StaticResource isFavoriteToVisibility}}

The LongListSelector databinding requirements for getting the group headers and such requires a datasource like ObservableCollection<ObservableCollection<MyItem>> (which is confusing just to look at!). Essentially, the outer collection is the Groups and the the inner collection contains the displayed items. My items even implement the INotifyPropertyChanged interface. What I’d expected was for updates to my item’s properties to be automatically reflected in my databinding, not just the addition or removal of items from the collection.

If I toggle the property value nothing whatsoever happens until I manually refresh the binding which requires a full reload. It is possible that this control doesn’t respond the propertychanged events of the individual items.

What I need is help figuring out what I can do to trigger an update of an individual list item after I have changed a property of it’s bound object?

Update:

Claus, the code that you created was VERY helpful (sorry, I don’t have enough rep to vote you up yet!) Using that code I was able to significantly simplify my code, and do more tests, but it still doesn’t solve my problem.

What I’ve now determined is that my binding is fine. If I change the property when bound simply to a text field text="{Binding IsFavorite}" it updates flawlessly. What doesn’t seem to work is when I update that same property when bound to the IValueConverter Visibility="{Binding Converter={StaticResource isFavoriteToVisibility}}" it doesn’t update. The converter works fine at initial binding, but not on property change. To go farther with testing, I bound the same bool property to both a text field and the IValueConverter. When I change the bool value the text field updates, but not the field bound using the converter.

public class VisibilityConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        Chemical chem = value as Chemical;

        if (chem == null)
            return Visibility.Collapsed;

        if (chem.IsFavorite)
            return Visibility.Visible;
        else
            return Visibility.Collapsed;
    }

    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}

XAML:

<myNS:ChemicalToFavoriteVisibilityConverter x:Key="isFavoriteToVisibility" />

<Rectangle Grid.Column="0" 
           Fill="{StaticResource PhoneContrastBackgroundBrush}" 
           Height="26" Stroke="Black"  Width="26" 
           Visibility="{Binding Converter={StaticResource isFavoriteToVisibility}}">
    <Rectangle.OpacityMask>
        <ImageBrush ImageSource="/Images/star_big.png"/>
    </Rectangle.OpacityMask>
</Rectangle>
<StackPanel Grid.Column="1"  Margin="0,0,0,0">
    <TextBlock Text="{Binding IsFavorite}" 
               TextWrapping="Wrap" 
               Style="{StaticResource PhoneTextLargeStyle}" 
               Foreground="{StaticResource PhoneForegroundBrush}"/>
</StackPanel>
  • 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-24T06:12:46+00:00Added an answer on May 24, 2026 at 6:12 am

    I solved the problem. The problem was that I was passing the entire object to the IValueConverter instead of the specific property that changed within the object. I changed the converter to specifically handle conversion of bool to Visibility and fixed the binding:

    public class BoolToVisibilityConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            bool boolValue = (bool)value;
    
            return boolValue ? Visibility.Visible : Visibility.Collapsed;
        }
    
        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
    

    The binding changed from:
    Visibility="{Binding Converter={StaticResource isFavoriteToVisibility}}"

    to:
    Visibility="{Binding Converter={StaticResource isFavoriteToVisibility}, Path=IsFavorite}"

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

Sidebar

Related Questions

I'd like to use a designer (e.g. Expression Blend) to template the LongListSelector control
Let's go with the toolkit example of LongListSelector, but say I'd like to display
I have a List<PublicGrouping<DateTime,Event>> used in a LongListSelector for a windows phone 7 project.
i have a long list selector in which i'm displaying data sorted by date.
Say if I need to display a list with lots and lots of records,
i have this LongListSelector bound to observerableCollection <DataTemplate x:Key=ucItems > <Grid Margin=0,0,0,17> <TextBlock Text={Binding
I have a simple LongListSelector from wp7 toolkit. Now I want to disable opening
I have a problem, I need to get the selected Item from a ContextMenu
I'm trying to work with the LongListSelector control from the WP7 Silverlight Toolkit. It's
I'm developing a Windows Phone 7 (WP7) app and I'm using a LongListSelector control

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.