I've two Frames with bound style properties and for each a tap event to change the actual content view:
<Frame Style="{Binding frameStyle1}"> ... <Frame.GestureRecognizers> <TapGestureRecognizer Tapped="FocusView1" NumberOfTapsRequired="1" /> </Frame.GestureRecognizers> </Frame> <Frame Style="{Binding frameStyle2}"> ... <Frame.GestureRecognizers> <TapGestureRecognizer Tapped="FocusView2" NumberOfTapsRequired="1" /> </Frame.GestureRecognizers> </Frame>
In the code behind I have this implementation of the properties and event handlers:
`public ContentView activeView {
get { return _activeView; }
set { if(_activeView != value) {
_activeView = value;
OnPropertyChanged("activeView"); }
}
}
public Style frameStyle1 {
get {
return (Style)(activeView == view1 ? App.Current.Resources["activeFrameStyle"] : App.Current.Resources["frameStyle"]);
}
}
public Style frameStyle2 {
get {
return (Style)(activeView == _view2 ? App.Current.Resources["activeFrameStyle"] : App.Current.Resources["frameStyle"]);
}
}
void FocusView1(object sender, EventArgs e) {
activeView = _view1;
}
void FocusView2(object sender, EventArgs e) {
activeView = _view2;
}`
My intention is to change style of all frames based on the current active view. On the application load the styles are set correctly but they are not updated when changing the active view.
Thanks for any help in advance...