public void SetSplitViewStyle() { Debug.WriteLine("GETTING STYLE!!!"); // Get listview controls inside the SplitView var spv = Helper.FindChild <SplitView>(Control.Parent, "SplitView"); Debug.WriteLine(spv); foreach (Windows.UI.Xaml.Controls.ListView lv in Helper.FindVisualChildren <Windows.UI.Xaml.Controls.ListView>(spv)) { Debug.WriteLine("APPLYING STYLE!!!!!!!!!!!!!!!!!"); // Add custom style lv.ItemContainerStyle = (Windows.UI.Xaml.Style)Windows.UI.Xaml.Application.Current.Resources["SplitViewItemContainerStyle"]; // Remove listview opening transition TransitionCollection tc = lv.ItemContainerTransitions; for (int i = tc.Count - 1; i >= 0; i--) { if (tc[i] is AddDeleteThemeTransition) { tc.RemoveAt(i); } } } spv.SizeChanged += Spv_SizeChanged; }
private void MainPage_Loaded(object sender, RoutedEventArgs e) { try { UpdateRotation(); //await Task.Delay(1500); Debug.WriteLine("Getting style.........."); // Get listview controls inside the SplitView var spv = Helper.FindChild <SplitView>(((MainPage)sender), "SplitView"); Debug.WriteLine(spv); foreach (ListView lv in Helper.FindVisualChildren <ListView>(spv)) { Debug.WriteLine("APPLYING STYLE!!!!!!!!!!!!!!!!!"); // Add custom style lv.ItemContainerStyle = (Style)Application.Current.Resources["SplitViewItemContainerStyle"]; // Remove listview opening transition TransitionCollection tc = lv.ItemContainerTransitions; for (int i = tc.Count - 1; i >= 0; i--) { if (tc[i] is AddDeleteThemeTransition) { tc.RemoveAt(i); } } } spv.SizeChanged += Spv_SizeChanged; //var btn = this.FindChildControl<Button>("PaneTogglePane"); //if (btn != null) //{ // btn.Click += Btn_Click; //} //var btn2 = this.FindChildControl<Button>("ContentTogglePane"); //if (btn2 != null) //{ // btn2.Click += Btn_Click; //} } catch (Exception ex) { Debug.WriteLine("JWChinese.UWP MainPage_Loaded Exception ex => " + ex.Message); } }