Reputation: 203
I am using
<toolkit:PickerBox/>
How to change the background of it to a different color when opened in FullMode?
Thanks in advance.
Upvotes: 0
Views: 123
Reputation: 203
Copy the PickerBoxPage.xaml from the location /Microsoft.Phone.Controls.Toolkit/PickerBox/PickerBoxPage.xaml to your local project folder.
Edit the background of the page to your desired background color.
Set the PickerPageUri of the toolkit:PickerBox to : your_localfolder_name/PickerBoxPage.xaml
For example:
<toolkit:PickerBox PickerPageUri="/View/PickerBoxPage.xaml" />
Its all done.
Thank you :)
Upvotes: 1
Reputation: 6260
Previously in xaml
we were using DataTriggers for such purposes. In WinRT as well as WP8 apps this concept was eliminated. You can use Visual States instead:
<VisualState x:Name="Maximized">
<Storyboard>
<ColorAnimation To="Green" Storyboard.TargetProperty="(ContentContainer.Background).(SolidColorBrush.Color)" Storyboard.TargetName="ButtonBackground" Duration="0"/>
</Storyboard>
</VisualState>
To change VisualState
depending on the size of PickerBox
you'll have to use behavior which will change states depending on pickers size (subscribe to the SizeChanged
event):
private void SizeChanged(object sender, SizeChangedEventArgs e)
{
UpdateVisualState();
}
private void UpdateVisualState()
{
var state = string.Empty;
// calculate state here (Normal vs Maximized)
VisualStateManager.GoToState(this, state, true);
}
Upvotes: 0