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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:51:50+00:00 2026-06-12T02:51:50+00:00

I have a really strange issue in an app in WPF with a lot

  • 0

I have a really strange issue in an app in WPF with a lot of screens working really well with bindings and Comboboxes. But one of them is causing me issues.

I created a screen to define a profile to each user defined in the app. So it’s a Listview with each row being a label (the user name) and a combobox with the list of profiles.
Everything is defined through binding.

Here is the XAML for the ListView (I removed styles) :

<ListView Name="lv_UserProfils" ItemsSource="{Binding ListeEntites}" AlternationCount="2"
ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto">
    <ListView.View>
        <GridView>
            <GridViewColumn Header="Nom d'utilisateur" Width="250">
                <GridViewColumn.CellTemplate>
                    <DataTemplate>
                        <Border Height="25">
                            <TextBlock Text="{Binding UserLogin}" Width="Auto" />
                        </Border>
                    </DataTemplate>
                </GridViewColumn.CellTemplate>
            </GridViewColumn>
            <GridViewColumn Header="Profil" Width="Auto">
                <GridViewColumn.CellTemplate>
                    <DataTemplate>
                        <ComboBox 
                                        ItemsSource="{Binding DataContext.ListeProfils, ElementName=lv_UserProfils}" 
                                        DisplayMemberPath="LibProfil" SelectedValuePath="IdProfil" 
                                        SelectedValue="{Binding Profil.IdProfil}" 
                                        SelectedItem="{Binding Profil}" Width="200" />
                    </DataTemplate>
                </GridViewColumn.CellTemplate>
            </GridViewColumn>
        </GridView>
    </ListView.View>
</ListView>

The DataContext is an instance of a custom ViewModel class, that provides an ObservableCollection<UserBE> named ListeEntites

UserBE is more or less :

public sealed class UserBE
{
public bool IsAdmin { get; set; }
public bool IsUpdateGranted { get; set; }

private string _userLogin;
public string UserLogin
{
    get { return _userLogin; }
    set { _userLogin = value; OnPropertyChanged("UserLogin"); }
}

private ProfilBE _profil;
public ProfilBE Profil
{
    get { return _profil; }
    set
    {
        _profil = value;
        OnPropertyChanged("Profil");
    }
}
}

And ProfilBE is

public sealed class ProfilBE
{
    public long IdProfil { get; set; }

    private string _codProfil;
    public string CodProfil
    {
        get { return _codProfil; }
        set { _codProfil = value; OnPropertyChanged("CodProfil"); }
    }

    private string _libProfil;
    public string LibProfil
    {
        get { return _libProfil; }
        set { _libProfil = value; OnPropertyChanged("LibProfil"); }
    }
}

Here is my problem :
The list of users is quite long so there is a scrollbar. I can scrolldown as much as I want but as soon as I scroll up (but only if I scrolled down enough), all comboboxes that were not displayed start to be cleared as soon as they appear on screen.

Interesting facts :

  • When I’m scrolling, the Profil setter is constantly called on the objects associated with the rows displayed. I’m not sure why (no reason, the Profil property is already defined)
  • At one point, if I scroll up, I get a lot of those exceptions, and the Profil setter start receiving null as value

.

System.Windows.Data Error: 23 : Cannot convert 'BanquePrivee.AssuranceVie.Net.BE.ProfilBE' from type 'ProfilBE' to type 'System.Int64' for 'fr-FR' culture with default conversions; consider using Converter property of Binding. NotSupportedException:'System.NotSupportedException: Int64Converter cannot convert from BanquePrivee.AssuranceVie.Net.BE.ProfilBE.
   at System.ComponentModel.TypeConverter.GetConvertFromException(Object value)
   at System.ComponentModel.TypeConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
   at System.ComponentModel.BaseNumberConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
   at MS.Internal.Data.DefaultValueConverter.ConvertHelper(Object o, Type destinationType, DependencyObject targetElement, CultureInfo culture, Boolean isForward)'

System.Windows.Data Error: 7 : ConvertBack cannot convert value 'BanquePrivee.AssuranceVie.Net.BE.ProfilBE' (type 'ProfilBE'). BindingExpression:Path=Profil.IdProfil; DataItem='UserBE' (HashCode=59629589); target element is 'ComboBox' (Name=''); target property is 'SelectedValue' (type 'Object') NotSupportedException:'System.NotSupportedException: Int64Converter cannot convert from BanquePrivee.AssuranceVie.Net.BE.ProfilBE.
   at MS.Internal.Data.DefaultValueConverter.ConvertHelper(Object o, Type destinationType, DependencyObject targetElement, CultureInfo culture, Boolean isForward)
   at MS.Internal.Data.ObjectTargetConverter.ConvertBack(Object o, Type type, Object parameter, CultureInfo culture)
   at System.Windows.Data.BindingExpression.ConvertBackHelper(IValueConverter converter, Object value, Type sourceType, Object parameter, CultureInfo culture)'

This is obvious that the SelectedValue="{Binding Profil.IdProfil}" is the issue but I don’t understand why.
I don’t understand why at some point it tries to cast the IdProfil to an ProfilBE. I shouldn’t have to use a Converter there.
I did a lot of testing and the data seem to be fine (no null value where there shouldn’t be, etc.)

Can someone point me where I did something wrong ?

  • 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-12T02:51:52+00:00Added an answer on June 12, 2026 at 2:51 am

    WPF is virtualizing objects that are not currently displayed.
    But when I try to scroll up, it seems to try to do something that doesn’t work on the items that were virtualized and are about to appear on the screen again.

    The solution I used is to disable virtualization for the ListView using VirtualizingStackPanel.IsVirtualizing="False". It has a small performance hit, but now it works.

    <ListView Name="lv_UserProfils" ItemsSource="{Binding ListeEntites}" AlternationCount="2" VirtualizingStackPanel.IsVirtualizing="False"
            ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto">
        <ListView.View>
            [...]
        </ListView.View>
    </ListView>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a really strange issue. I am working on a Java SWING application
I spent few hours trying to resolve one very strange issue, but I really
I have a really strange issue in my project. I have a facebook app
I'm having a really strange issue. I've written an app with five tabs in
I have a really strange orientation issue. I have a sequence of view controllers
I have a really strange issue when using hibernate to connect to a MySQLDB
i'm seeing a really strange issue with asp.net rendering. i have EXACTLY this in
I have a really strange issue relating to how I handle navigation in an
I am currently struggling with a really really strange issue. I have a telephone
I am having a really strange issue with my edit page: If I have

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.