public RatingControlPage() { this.InitializeComponent(); TestRatingControl.ValueChanged += TestRatingControl_ValueChanged; RatingDarkTheme.PlaceholderValue = 1.5; MyRatingReadOnlyTextBlock.Text = "2.2"; MyRatingReadOnlyWithPlaceholder.PlaceholderValue = 3.3; DisabledWithValue.Value = 3; DisabledWithPlaceholderValue.PlaceholderValue = 3; CustomImages.Value = 3.0; CustomImages.PlaceholderValue = 1.5; var imageInfo = new RatingItemImageInfo(); imageInfo.Image = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri("ms-appx:/Assets/rating_set.png")); imageInfo.UnsetImage = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri("ms-appx:/Assets/rating_unset.png"));; imageInfo.PlaceholderImage = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri("ms-appx:/Assets/rating_placeholder.png"));; imageInfo.DisabledImage = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri("ms-appx:/Assets/rating_disabled.png"));; imageInfo.PointerOverImage = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri("ms-appx:/Assets/rating_mouseoverset.png"));; imageInfo.PointerOverPlaceholderImage = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri("ms-appx:/Assets/rating_mouseoverplaceholder.png")); CustomImagesTwo.ItemInfo = imageInfo; CustomImagesTwo.Value = 3.0; CustomImagesTwo.PlaceholderValue = 4.25; PointerOverPlaceholderFallbackRating.AddHandler(RatingControl.PointerMovedEvent, new PointerEventHandler(PointerOverPlaceholderFallbackRating_PointerMoved), true); PointerOverFallbackRating.AddHandler(RatingControl.PointerMovedEvent, new PointerEventHandler(PointerOverFallbackRating_PointerMoved), true); PointerOverPlaceholderImageFallbackRating.AddHandler(RatingControl.PointerMovedEvent, new PointerEventHandler(PointerOverPlaceholderImageFallbackRating_PointerMoved), true); PointerOverImageFallbackRating.AddHandler(RatingControl.PointerMovedEvent, new PointerEventHandler(PointerOverImageFallbackRating_PointerMoved), true); ColorFlipButton.Foreground = _tomato; RatingBindingSample.DataContext = CaptionStringBox; BindingRatingCaption.DataContext = ColorFlipButton; //TODO: Uno Platform - WinUI wraps controls in a "TestFrame" which has some "ambient" features, including the view scaling checkbox //var testFrame = Window.Current.Content as TestFrame; //DependencyObject checkBox = SearchVisualTree(testFrame, "ViewScalingCheckBox"); //CheckBox cb = checkBox as CheckBox; //FrameDetails.Text = Window.Current.Bounds.ToString() + " " + cb.IsChecked.ToString(); #if !HAS_UNO if (ApiInformation.IsTypePresent("Windows.UI.Xaml.Controls.RatingControl")) { var wuxcRatingControl = new Windows.UI.Xaml.Controls.RatingControl(); wuxcRatingControl.Name = "WUXC RatingControl"; wuxcRatingControl.Caption = "WUXC RatingControl"; AutomationProperties.SetAutomationId(wuxcRatingControl, "wuxcRatingControl"); this.mainStackPanel.Children.Add(wuxcRatingControl); } #endif }
public RatingControlPage() { this.InitializeComponent(); TestRatingControl.ValueChanged += TestRatingControl_ValueChanged; RatingDarkTheme.PlaceholderValue = 1.5; MyRatingReadOnlyTextBlock.Text = "2.2"; MyRatingReadOnlyWithPlaceholder.PlaceholderValue = 3.3; DisabledWithValue.Value = 3; DisabledWithPlaceholderValue.PlaceholderValue = 3; CustomImages.Value = 3.0; CustomImages.PlaceholderValue = 1.5; var imageInfo = new RatingItemImageInfo(); imageInfo.Image = new BitmapImage(new Uri("pack://application:,,,/Assets/rating_set.png")); imageInfo.UnsetImage = new BitmapImage(new Uri("pack://application:,,,/Assets/rating_unset.png"));; imageInfo.PlaceholderImage = new BitmapImage(new Uri("pack://application:,,,/Assets/rating_placeholder.png"));; imageInfo.DisabledImage = new BitmapImage(new Uri("pack://application:,,,/Assets/rating_disabled.png"));; imageInfo.PointerOverImage = new BitmapImage(new Uri("pack://application:,,,/Assets/rating_mouseoverset.png"));; imageInfo.PointerOverPlaceholderImage = new BitmapImage(new Uri("pack://application:,,,/Assets/rating_mouseoverplaceholder.png")); CustomImagesTwo.ItemInfo = imageInfo; CustomImagesTwo.Value = 3.0; CustomImagesTwo.PlaceholderValue = 4.25; PointerOverPlaceholderFallbackRating.AddHandler(RatingControl.MouseMoveEvent, new MouseEventHandler(PointerOverPlaceholderFallbackRating_PointerMoved), true); PointerOverFallbackRating.AddHandler(RatingControl.MouseMoveEvent, new MouseEventHandler(PointerOverFallbackRating_PointerMoved), true); PointerOverPlaceholderImageFallbackRating.AddHandler(RatingControl.MouseMoveEvent, new MouseEventHandler(PointerOverPlaceholderImageFallbackRating_PointerMoved), true); PointerOverImageFallbackRating.AddHandler(RatingControl.MouseMoveEvent, new MouseEventHandler(PointerOverImageFallbackRating_PointerMoved), true); ColorFlipButton.Foreground = _tomato; RatingBindingSample.DataContext = CaptionStringBox; BindingRatingCaption.DataContext = ColorFlipButton; //var testFrame = Window.Current.Content as TestFrame; //DependencyObject checkBox = SearchVisualTree(testFrame, "ViewScalingCheckBox"); //CheckBox cb = checkBox as CheckBox; //FrameDetails.Text = Window.Current.Bounds.ToString() + " " + cb.IsChecked.ToString(); //if (ApiInformation.IsTypePresent("Windows.UI.Xaml.Controls.RatingControl")) //{ // var wuxcRatingControl = new Windows.UI.Xaml.Controls.RatingControl(); // wuxcRatingControl.Name = "WUXC RatingControl"; // wuxcRatingControl.Caption = "WUXC RatingControl"; // AutomationProperties.SetAutomationId(wuxcRatingControl, "wuxcRatingControl"); // this.mainStackPanel.Children.Add(wuxcRatingControl); //} }
public RatingControlPage() { this.InitializeComponent(); TestRatingControl.ValueChanged += TestRatingControl_ValueChanged; RatingDarkTheme.PlaceholderValue = 1.5; MyRatingReadOnlyTextBlock.Text = "2.2"; MyRatingReadOnlyWithPlaceholder.PlaceholderValue = 3.3; DisabledWithValue.Value = 3; DisabledWithPlaceholderValue.PlaceholderValue = 3; CustomImages.Value = 3.0; CustomImages.PlaceholderValue = 1.5; var imageInfo = new RatingItemImageInfo(); imageInfo.Image = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri("ms-appx:/Assets/rating_set.png")); imageInfo.UnsetImage = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri("ms-appx:/Assets/rating_unset.png"));; imageInfo.PlaceholderImage = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri("ms-appx:/Assets/rating_placeholder.png"));; imageInfo.DisabledImage = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri("ms-appx:/Assets/rating_disabled.png"));; imageInfo.PointerOverImage = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri("ms-appx:/Assets/rating_mouseoverset.png"));; imageInfo.PointerOverPlaceholderImage = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri("ms-appx:/Assets/rating_mouseoverplaceholder.png")); CustomImagesTwo.ItemInfo = imageInfo; CustomImagesTwo.Value = 3.0; CustomImagesTwo.PlaceholderValue = 4.25; PointerOverPlaceholderFallbackRating.AddHandler(RatingControl.PointerMovedEvent, new PointerEventHandler(PointerOverPlaceholderFallbackRating_PointerMoved), true); PointerOverFallbackRating.AddHandler(RatingControl.PointerMovedEvent, new PointerEventHandler(PointerOverFallbackRating_PointerMoved), true); PointerOverPlaceholderImageFallbackRating.AddHandler(RatingControl.PointerMovedEvent, new PointerEventHandler(PointerOverPlaceholderImageFallbackRating_PointerMoved), true); PointerOverImageFallbackRating.AddHandler(RatingControl.PointerMovedEvent, new PointerEventHandler(PointerOverImageFallbackRating_PointerMoved), true); ColorFlipButton.Foreground = _tomato; RatingBindingSample.DataContext = CaptionStringBox; BindingRatingCaption.DataContext = ColorFlipButton; FrameDetails.Text = Window.Current.Bounds.ToString(); if (ApiInformation.IsTypePresent("Windows.UI.Xaml.Controls.RatingControl")) { var wuxcRatingControl = new Windows.UI.Xaml.Controls.RatingControl(); wuxcRatingControl.Name = "WUXC RatingControl"; wuxcRatingControl.Caption = "WUXC RatingControl"; AutomationProperties.SetAutomationId(wuxcRatingControl, "wuxcRatingControl"); this.mainStackPanel.Children.Add(wuxcRatingControl); } }