/// <summary> /// Initializes a new instance of the <see cref="SampleBrowser"/> class. /// </summary> public static NavigationPage GetMainPage(object controlsList, string assemblyName) { IsIndividualSB = true; ContentPage contentPage; bool isUpdated = false; var controls = controlsList as ControlModel; var samples = GetSamplesData(assemblyName + ".SamplesList.SamplesList.xml", assemblyName, ref isUpdated); if (samples != null && !string.IsNullOrEmpty(assemblyName)) { if (assemblyName == "SampleBrowser.SfChart") { contentPage = new ChartSamplesPage(samples, 0); } else { if (controls != null) { contentPage = new AllControlsSamplePage(controls, samples, controls.Title, 0); } else { contentPage = new AllControlsSamplePage(controlsList, samples, controlsList.ToString(), 0); } } } else { contentPage = new ContentPage(); } return(new NavigationPage(contentPage) { BarTextColor = Color.White, BarBackgroundColor = Color.FromHex("007DE6") }); }
/// <summary> /// Initializes a new instance of the <see cref="ChartSampleView"/> class. /// </summary> public ChartSampleView(object sampleList, ToolbarItem settingsBtn, ChartSamplesPage chartSamplePage, int index) { InitializeComponent(); this.chartSamplePage = chartSamplePage; if (Device.RuntimePlatform == Device.UWP && Device.Idiom != TargetIdiom.Phone) { listView.ItemTemplate = new LabelColorSelector(); closeButton.MinimumHeightRequest = 10; closeButton.MinimumWidthRequest = 10; closeButton.HeightRequest = 40; closeButton.WidthRequest = 40; closeButton.Margin = new Thickness(0, 0, 5, 0); boxRowDef.Height = 0; } else { boxRowDef.Height = 1; } if (Device.Idiom == TargetIdiom.Phone) { optionsHeight = (float)(0.5 * samplesHeight); propertyView.HeightRequest = optionsHeight; } settingsButton = settingsBtn; if (sampleList != null) { var samples = sampleList as ObservableCollection <SampleModel>; var type = DependencyService.Get <ISampleBrowserService>().GetAssembliesType("SampleBrowser.SfChart", samples[index].Name); listView.ItemsSource = samples; listView.SelectedItem = samples[index]; selectedSample = samples[index].Name; previousSample = type; listView.BackgroundColor = Device.Idiom == TargetIdiom.Desktop ? Color.FromHex("343435") : Color.FromHex("F2F2F2"); if (type != null) { var instance = AllControlsSamplePage.CreateInstance(type); SetRowColumn(instance); chartTypesGrid.Children.Add(instance); if (instance.PropertyView != null) { this.chartSamplePage.IsPropertyWindowVisible = true; settingsButton.Icon = "Option.png"; propertyContent.Content = instance.PropertyView; settingsButton.Clicked -= OptionsButton_Clicked; settingsButton.Clicked += OptionsButton_Clicked; } else { this.chartSamplePage.IsPropertyWindowVisible = false; settingsButton.Icon = string.Empty; } } } if (listView != null) { listView.ItemTapped += ListView_ItemTapped; } }