Thursday, December 22, 2011

Displaying items horizontaly in WPF ItemsControl

I am trying my hand on Microsoft Composite Application for few days. I was trying to display list of Actions available from a moudle into a Region using following markup:

  
        
            
                
                    
                
            
            
                
                    
                        
                            
                        
                    
                
            
        
    

This displays items in vertical manner (as is default with ItemsControl and its derivatives like ListBox). I added following code to make it use StackPanel:

    
        
            
        
     

But it did not produce the desired outcome. I tried the WrapPanel also but it was still same. After some more frustration I commented GroupStyle tag:

    
        
            
                
                    
                
           
        
     

Now it worked as desired by displaying Button controls in a single row.