I need Horizontal view of list boxes

后端 未结 5 611
情话喂你
情话喂你 2021-01-25 07:22

I am working on list boxes in WPF. I want to show the list boxes in horizontal direction. My code is



    

        
5条回答
  •  不要未来只要你来
    2021-01-25 07:47

    I post this answer because of informational purposes as an alternative way of doing things:

    Entities/Classes:

      public class Person
      {
        public string Name { get; set; }
    
        public string Phone { get; set; }
    
        public string Email { get; set; }
    
        public Contact Contact1 { get; set; }
      }
    
      public class Contact
      {
        public string Name { get; set; }
      }
    

    Code Behind:

      Persons = new List( );
      for ( int i = 0; i < 15; i++ )
      {
        Persons.Add( new Person( ) 
                     { 
                       Name = String.Format( "Name {0}" , i ) , 
                       Phone = String.Format( "Phone 0000000-00{0}" , i ) , 
                       Email = String.Format( "Emailaddress{0}@test.test" , i ) , 
                       Contact1 = new Contact { Name = String.Format("Contact name = {0}", i) }
                     } );
      }
      list.DataContext = Persons;
    

    Xaml proposal 1:

    
            
              
                
                  
              
            
            
              
                
              
            
          
    

    Xaml proposal 2:

    
          
            
              
                
                  
              
            
            
              
                
              
            
          
        
    

提交回复
热议问题