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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:37:06+00:00 2026-05-27T13:37:06+00:00

If I have a List<Tuple<DateTime,DateTime>> can I bind that to list box in wpf?

  • 0

If I have a List<Tuple<DateTime,DateTime>> can I bind that to list box in wpf? I know of course I can bind to dictionaries or whatever but in this cause I need to send back a list that could possible have identical values so it makes sense (or seems to) make sense to have a list of tuples? Anyone got any thoughts?

  • 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-27T13:37:07+00:00Added an answer on May 27, 2026 at 1:37 pm

    Sure, you can bind to it. I threw together the following code behind:

    public partial class MainWindow : Window
    {
        private readonly ObservableCollection<Tuple<DateTime, DateTime>> _dates = new ObservableCollection<Tuple<DateTime,DateTime>>();
        public ObservableCollection<Tuple<DateTime, DateTime>> Dates { get { return _dates; } }
    
        public MainWindow()
        {
            DataContext = this;
            InitializeComponent();
            PopulateList();
        }
    
        private void PopulateList()
        {
            _dates.Add(new Tuple<DateTime, DateTime>(DateTime.Now, DateTime.Now));
            _dates.Add(new Tuple<DateTime, DateTime>(DateTime.Now, DateTime.Now));
            _dates.Add(new Tuple<DateTime, DateTime>(DateTime.Now, DateTime.Now));
        }
    }
    

    And XAML:

    <Window x:Class="GuiScratch.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="MainWindow" Height="350" Width="525">
        <Grid>
            <ListBox ItemsSource="{Binding Dates}"/>
    
        </Grid>
    </Window>
    

    When I run that, I see a list of items with two datetimes concatenated as list members.

    That said, whether you want to do this or not probably depends more on specific context. If the need to have very pluggable binding types makes sense (i.e. date time may change to string or int), this may be a good option. If you don’t, I’d say you’d be better off binding to something more expressive.

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

Sidebar

Related Questions

How can i have a tuple that has a list as a value. F.x.
I have a List of tuple <Tuple<int, int>> x in that I am getting
I have a list like this: List<Tuple<int, int, int>> list = new List<Tuple<int, int,
I have trouble sorting two related but separate lists of tuple lists. One list
Supposing I have a list/tuple like this: MyLocation = 'DE' ( ('Pencils', 'Artists Pencils',
I have a list of tuples that look something like this: (Person 1,10) (Person
Say that you have a sorted list of n timestamps (Python datetime objects). How
how join tuple list a dict? this is what i have: [('a','b'),('c','d'),('e','f')] and this
In Python, you can pass a list or tuple to a function and have
I have a list of tuple, the list was sorted based on the first

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.