Sub TabStrip1_PageSelected (Position As Int)
Log("Current page: " & Position)
For i = 0 To TabPages.Size - 1
Dim p As Page = TabPages.Get(i)
Dim lbl As Label = p.TitleView
Dim clr As Int
If i = Position Then clr = Colors.Red Else clr = Colors.Black
Dim cs As CSBuilder
SetAttributedTitle(p, cs.Initialize.Color(clr).Append(lbl.AttributedText.ToString).PopAll)
Next
PageSelectedEventIndex = PageSelectedEventIndex + 1 'this is a global variable
Dim MyIndex As Int = PageSelectedEventIndex
Dim no As NativeObject = TabStrip1
Sleep(300)
If MyIndex = PageSelectedEventIndex Then
no.RunMethod("reloadPagerTabStripView", Null)
End If
End Sub