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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:25:26+00:00 2026-05-25T02:25:26+00:00

I have a combobox filled with int’s representing years. The years I have add

  • 0

I have a combobox filled with int’s representing years. The years I have add them to an ObservableCollection, but my problem is when I load the project the combobox its blank by default. I want to set a default name to it, like “Years”, but I don’t want solution like set the isEditable to true, or inserting a string at the beginning. I want a pure xaml solution if it is posible.

This is my current xaml file:

<RSControls:SmoothScrollComboBox Grid.Column="1" x:Name="compilationYearCombo" Margin="7,2.04,0,2.04"                                                                                     
                            SelectedValue="{Binding Path=SelectedYear}"
                            SelectedValuePath=""
                            ItemsSource="{Binding Years}"
                            DisplayMemberPath="" SelectionChanged="compilationYearCombo_SelectionChanged" IsSynchronizedWithCurrentItem="True" Grid.ColumnSpan="2" IsEditable="False" SelectedIndex="0" IsReadOnly="False" Text="Years">

                        </RSControls:SmoothScrollComboBox>

I tried adding a <TextBlock Text="Years" /> , but that only changed all the elements in the combo to “Years”.

I apreciatte a detail explenation how to this, I am just a beginner with WPF.

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-25T02:25:27+00:00Added an answer on May 25, 2026 at 2:25 am

    You can add a visibility converter to your TextBlock

       <TextBlock
               Visibility="{Binding SelectedItem, ElementName=compilationYearCombo, Converter={StaticResource NullToVisibilityConverter}}"
               IsHitTestVisible="False"
               Text="Years" />
    

    with this converter:

        public class NullToVisibilityConverter : IValueConverter
    {
        #region Implementation of IValueConverter
    
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return value == null ? Visibility.Visible : Visibility.Collapsed;
        }
    
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    
        #endregion
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The problem is strange, I have a combobox which is correctly filled with items
I have a combobox that is filled with data field JobCode from database. There
I have a ComboBox bound to an ObservableCollection of decimals. What is the correct
I have a combobox that passes along values in text, but they can have
I have: ComboBox.DataSource = System.Enum.GetValues(typeof(ImageLayout)); but how do I set the ComboBox.SelectedItem to an
I have a ComboBox with its elements loaded from a sqlserver table (groups). I
I've got a problem with VB6. I have a form with several ComboBox objects
I have a Silverlight application with a ComboBox that is filled by VideoCaptureDevice 's.
Project: Winforms, .NET framework: 3.5 (Visual Studio 2008) My problem is: I have a
I have a ComboBox filled with a custom Class called TableHeader, this class contains

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.