开发者

wp7 ListBox SelectionChanged Text Color

开发者 https://www.devze.com 2023-03-24 06:39 出处:网络
The default behaviour for a ListBox used in a WP7 application is for the selected item to be highlighted in the PhoneAccentBrush.I am finding that with a ListBox that when I handle the SelectionChange

The default behaviour for a ListBox used in a WP7 application is for the selected item to be highlighted in the PhoneAccentBrush. I am finding that with a ListBox that when I handle the SelectionChanged event (sets a property and closes popup that contains the ListBox) I never see the text color change to the PhoneAccentBrush - so the user never gets any feedback that they have selected the correct item. Is there a way to work around this and give the user feedback (even though it will only be momentary开发者_如何学C) as to which item they have selected.


Delay your handling of SelectionChanged event, for example

void list_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
    Dispatcher.BeginInvoke(action);
}

void action()
{
    // put your code here
}


Take the Silverlight toolkit and add a tilt effect (push animation like in other apps).

Reference the toolkit in your project and add the namespace to use the toolkit:

<phone:PhoneApplicationPage 
    ...
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit">

In your datatemplate add the attached property IsTiltEnabled:

<DataTemplate>
    <Grid toolkit:TiltEffect.IsTiltEnabled="True">
        ...
    </Grid>
</DataTemplate>
0

精彩评论

暂无评论...
验证码 换一张
取 消