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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:39:56+00:00 2026-05-20T09:39:56+00:00

I found solution on this site(How can I input separator between items in an

  • 0

I found solution on this site(How can I input separator between items in an ItemsControl(click) And found bug=(((
Here is it:

enter image description here

It hapens when I trying to resize ItemsControl(I’ve set property “HorizontalScrollBarVisibility” to “Disable”) Any ideas How should I fix this bug?

  • 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-20T09:39:56+00:00Added an answer on May 20, 2026 at 9:39 am

    It was not easy,but I realized what shall I do to fix this bug. My idea is to use custom Convertor, but I haven’t any clever thoughts How to send ConverterParameter into convertor. But I’ve found solution.
    Here is my convertor:

    public class SeparatorConverter : IValueConverter
    {
        private Visibility _visible;
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var element = (TextBlock) value;
            element.Loaded += ElementLoaded;
            return _visible;
        }
    
        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return null; //not needed
        }
        private static void ElementLoaded(object sender, RoutedEventArgs e)
        {
            var element = sender as TextBlock;
            var parentItemsControl = element.FindParent(x => x is ItemsControl) as ItemsControl;
            var parentPanel = element.FindParent(x => x is Panel) as Panel;
    
            if (parentItemsControl == null || element == null || parentPanel== null)
                return;
    
            var itemText = parentPanel.FindName("MyTextBlock") as TextBlock;
            var collection = parentItemsControl.ItemsSource as IEnumerable<string>;
    
            if (itemText == null || collection == null)
                return;
    
            var list = collection.ToList();
            if (list.IndexOf(itemText.Text) == list.Count() - 1) // Can be incorrect because we can have two same items
               element.Visibility = Visibility.Collapsed;
        }
    }
    

    Find parent function:

    public static DependencyObject FindParent(this DependencyObject element, Func<DependencyObject, bool> filter)
        {
            DependencyObject parent = VisualTreeHelper.GetParent(element);
    
            if (parent != null)
            {
                if (filter(parent))
                {
                    return parent;
                }
    
                return FindParent(parent, filter);
            }
    
            return null;
        }
    

    Here is my XAML code:

      <Coverters:SeparatorConverter x:Key="SeparatorVisibilityConverter">
        </Coverters:SeparatorConverter>
        <ItemsControl Grid.Row="1" ItemsSource="{Binding Value, IsAsync=False}">
        <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate>
                <WrapPanel>
                </WrapPanel>
            </ItemsPanelTemplate>
        </ItemsControl.ItemsPanel>
        <ItemsControl.ItemTemplate>
            <DataTemplate>
                <WrapPanel>
                    <TextBlock x:Name="MyTextBlock" Text="{Binding}" Style="{StaticResource TextBlockInListViewItem}"  TextWrapping="WrapWithOverflow"/>
                    <TextBlock x:Name="commaTextBlock" Style="{StaticResource TextBlockInListViewItem}" Text=", " Visibility="{Binding RelativeSource={RelativeSource Self},
                                Converter={StaticResource SeparatorVisibilityConverter}}"/>
                </WrapPanel>
            </DataTemplate>
        </ItemsControl.ItemTemplate>
    </ItemsControl>
    

    Ok. Any way, If you have another idea how to fix this bug, you could post your answer here=)

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

Sidebar

Related Questions

I found the solution for this question in C# , but I can't translate
Edited to Add * I haven't found a solution for this one yet, can
I found the solution on this site for displaying a blank cell when the
I found this solution which works, but I find it hard to believe there
Edited: SOLUTION FOUND. This is strange and not the best solution, but I just
I edited this question after i found a solution... i need to understand why
problem euler #5 i found the solution but i don't know why this first
I've been looking around for a solution to this thing but I haven't found
This is something I've pseudo-solved many times and have never quite found a solution
Has anyone else had this issue and found a working solution? I've enabled the

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.