Silverlight 3: ListBox DataTemplate HorizontalAlignment

后端 未结 6 430
误落风尘
误落风尘 2020-12-05 10:24

I have a ListBox with it\'s ItemTemplate bound to a DataTemplate. My problem is I cannot get the elements in the template to stretch to the full width of the ListBox.

<
6条回答
  •  一整个雨季
    2020-12-05 10:38

    My ListBoxItem contained a CheckBox and the above solutions did not work for me (most likely due to the nature of a CheckBox, not those solutions) I was able to coerce this functionality by not binding to the "Content" property of the checkbox, but explicitely defining the XAML inline:

    
        
    
    

    The margin is needed because the TextBox text did not align with the CheckBox's checkmark. The MinWidth was also necessary.

提交回复
热议问题