How to use Canvas as the ItemsPanel for an ItemsControl in Silverlight 3

前端 未结 4 2015
闹比i
闹比i 2021-02-05 22:13

I am trying to set the Canvas properties in an ItemsControl DataTemplate with Silverlight 3. According to this post, the only way of doing that is to set it using the ItemsCont

4条回答
  •  没有蜡笔的小新
    2021-02-05 22:34

    Old post but I went into the same problem but now with SL5 that now allows Binding in style setters. I was trying to avoid to use the ListBox (because it handles selection and so on) and the ItemsControl still doesn't have an ItemContainerStyle. So I tried a few things.

    I haven't found many subject discussing this problem so let me share my solution (sorry if it duplicates)

    In fact, I found a very convenient way to solve the problem by adding an unnamed Style in the ItemsControl resources :

    
        
            
        
        
            
                
            
        
        
            
                ...
            
        
    
    

    Works like a charm in SL5 :)

提交回复
热议问题