Windows Phone 7 - Setting style for specific control within selected ListBoxItem

后端 未结 3 837
囚心锁ツ
囚心锁ツ 2020-12-20 09:31

let\'s say i have something like this:


    

        
3条回答
  •  再見小時候
    2020-12-20 09:50

    one way to achieve this is, create an extended ListBox class with a SecondText dependency property in it. Then just use Blend to generate a normal ListBox style, change the targat type to my ExtendedListBox.

    In this style, add another TextBlock control and set its Text TemplateBinding to the SecondText. You just need to alter this TextBlock's font size in the selected visual state.

    Also, rather than extending the ListBox, you might be able to create an attached property SecondText and just TemplateBinding to it directly, but I haven't tested this method yet.

    Hope this can get you started with. :)

提交回复
热议问题