private void MainPivot_Loaded(object sender, RoutedEventArgs e) { var width = Math.Max(MainPivot.ActualWidth / 3 - 24, 0); var headerTxts = VisualHelper.FindVisualChilds <TextBlock>(MainPivot, "HeaderTxt"); if (headerTxts != null) { headerTxts.ForEach(headerTxt => headerTxt.Width = width); } }
private void SearchPivot_Loaded(object sender, RoutedEventArgs e) { var lastVisibility = Visibility; Visibility = Visibility.Visible; UpdateLayout(); var width = Math.Max(SearchPivot.ActualWidth / 2 - 24, 0); var headerTxts = VisualHelper.FindVisualChilds <TextBlock>(SearchPivot, "HeaderTxt"); if (headerTxts != null) { headerTxts.ForEach(headerTxt => headerTxt.Width = width); } Visibility = lastVisibility; }