I’m trying to activate a State on a StateGroup from Uno code. The documentation says that changing StateGroups Active property will initiate the transition, so thats what I tried to do in my ‘Navigate’ function. Any ideas why this isn’t working?
public partial class TabViewer
{
List<TabContent> mContent = new List<TabContent>();
StateGroup mTabGridStateGroup = new StateGroup();
public TabViewer()
{
InitializeUX();
mxTabGrid.Behaviors.Add(mTabGridStateGroup);
}
public void AddContent(TabContent content)
{
//Add State
State state = new State();
Move move = new Move();
move.Target = mxTabRectangle;
move.X = mContent.Count;
move.RelativeTo = TranslationMode.Size;
move.Easing = Easing.SinusoidalInOut;
move.Duration = 0.3;
state.Animators.Add(move);
mTabGridStateGroup.States.Add(state);
mContent.Add(content);
//Resize TabRectangle
mxTabRectangle.Width = 100.0f/mContent.Count;
//Add button to TabBar
mxTabGrid.ColumnCount = mxTabGrid.ColumnCount + 1;
Z_NavButton button = new Z_NavButton();
button.Clicked += Navigate;
button.Text = content.Title;
mxTabGrid.Children.Add(button);
}
void Navigate(object sender, ClickedArgs args)
{
Button button = sender as Button;
for(int i = 0; i < mContent.Count; i++)
{
if(button.Text == mContent[i].Title)
{
mxTabNavigation.Goto(mContent[i].PageForTab);
mTabGridStateGroup.Active = mTabGridStateGroup.States[i];
break;
}
}
}
}