public void SymbolIconSourceTest() { SymbolIconSource iconSource = null; RunOnUIThread.Execute(() => { iconSource = new SymbolIconSource(); // IconSource.Foreground should be null to allow foreground inheritance from // the parent to work. Verify.AreEqual(iconSource.Foreground, null); Log.Comment("Validate the defaults match SymbolIcon."); var icon = new SymbolIcon(); Verify.AreEqual(icon.Symbol, iconSource.Symbol); Log.Comment("Validate that you can change the properties."); iconSource.Foreground = new SolidColorBrush(Windows.UI.Colors.Red); iconSource.Symbol = Symbol.HangUp; }); IdleSynchronizer.Wait(); RunOnUIThread.Execute(() => { Verify.IsTrue(iconSource.Foreground is SolidColorBrush); Verify.AreEqual(Windows.UI.Colors.Red, (iconSource.Foreground as SolidColorBrush).Color); Verify.AreEqual(Symbol.HangUp, iconSource.Symbol); }); }
private SymbolIconSource MakeSymbolIcon() { SymbolIconSource iconSource = new SymbolIconSource(); iconSource.Symbol = Symbol.Setting; iconSource.Foreground = iconForegroundBrush; return(iconSource); }
public void InfoBadgeDisplayKindTest() { InfoBadge infoBadge = null; SymbolIconSource symbolIconSource = null; RunOnUIThread.Execute(() => { infoBadge = new InfoBadge(); symbolIconSource = new SymbolIconSource(); symbolIconSource.Symbol = Symbol.Setting; Content = infoBadge; Content.UpdateLayout(); }); IdleSynchronizer.Wait(); RunOnUIThread.Execute(() => { FrameworkElement textBlock = infoBadge.FindVisualChildByName("ValueTextBlock"); Verify.IsNotNull(textBlock, "The underlying value text block could not be retrieved"); FrameworkElement iconViewBox = infoBadge.FindVisualChildByName("IconPresenter"); Verify.IsNotNull(textBlock, "The underlying icon presenter view box could not be retrieved"); Verify.AreEqual(Visibility.Collapsed, textBlock.Visibility, "The value text block should be initally collapsed since the default value is -1"); Verify.AreEqual(Visibility.Collapsed, iconViewBox.Visibility, "The icon presenter should be initally collapsed since the default value is null"); infoBadge.IconSource = symbolIconSource; Content.UpdateLayout(); Verify.AreEqual(Visibility.Collapsed, textBlock.Visibility, "The value text block should be initally collapsed since the default value is -1"); Verify.AreEqual(Visibility.Visible, iconViewBox.Visibility, "The icon presenter should be visible since we've set the icon source property and value is -1"); infoBadge.Value = 10; Content.UpdateLayout(); Verify.AreEqual(Visibility.Visible, textBlock.Visibility, "The value text block should be visible since the value is set to 10"); Verify.AreEqual(Visibility.Collapsed, iconViewBox.Visibility, "The icon presenter should be collapsed since we've set the icon source property but value is not -1"); infoBadge.IconSource = null; Content.UpdateLayout(); Verify.AreEqual(Visibility.Visible, textBlock.Visibility, "The value text block should be visible since the value is set to 10"); Verify.AreEqual(Visibility.Collapsed, iconViewBox.Visibility, "The icon presenter should be collapsed since the icon source property is null"); infoBadge.Value = -1; Content.UpdateLayout(); Verify.AreEqual(Visibility.Collapsed, textBlock.Visibility, "The value text block should be collapsed since the value is set to -1"); Verify.AreEqual(Visibility.Collapsed, iconViewBox.Visibility, "The icon presenter should be collapsed since the value is set to null"); }); }
public void TeachingTipWithContentAndWithoutHeroContentDoesNotCrash() { var loadedEvent = new AutoResetEvent(false); RunOnUIThread.Execute(() => { Grid contentGrid = new Grid(); SymbolIconSource iconSource = new SymbolIconSource(); iconSource.Symbol = Symbol.People; TeachingTip teachingTip = new TeachingTip(); teachingTip.Content = contentGrid; teachingTip.IconSource = (IconSource)iconSource; teachingTip.Loaded += (object sender, RoutedEventArgs args) => { loadedEvent.Set(); }; Content = teachingTip; }); IdleSynchronizer.Wait(); loadedEvent.WaitOne(); }
private void IconComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (TestInfoBar == null) { return; } switch (e.AddedItems[0].ToString()) { case "Custom Icon": SymbolIconSource symbolIcon = new SymbolIconSource(); symbolIcon.Symbol = Symbol.Pin; TestInfoBar.IconSource = (IconSource)symbolIcon; break; case "Default Icon": default: TestInfoBar.IconSource = null; break; } }
public void InfoBadgeSupportsAllIconTypes() { InfoBadge infoBadge = null; SymbolIconSource symbolIconSource = null; PathIconSource pathIconSource = null; AnimatedIconSource animatedIconSource = null; BitmapIconSource bitmapIconSource = null; ImageIconSource imageIconSource = null; FontIconSource fontIconSource = null; RunOnUIThread.Execute(() => { infoBadge = new InfoBadge(); symbolIconSource = new SymbolIconSource(); symbolIconSource.Symbol = Symbol.Setting; fontIconSource = new FontIconSource(); fontIconSource.Glyph = "99+"; fontIconSource.FontFamily = new FontFamily("XamlAutoFontFamily"); bitmapIconSource = new BitmapIconSource(); bitmapIconSource.ShowAsMonochrome = false; Uri bitmapUri = new Uri("ms-appx:/Assets/ingredient1.png"); bitmapIconSource.UriSource = bitmapUri; imageIconSource = new ImageIconSource(); var imageUri = new Uri("https://raw.githubusercontent.com/DiemenDesign/LibreICONS/master/svg-color/libre-camera-panorama.svg"); imageIconSource.ImageSource = new SvgImageSource(imageUri); pathIconSource = new PathIconSource(); var geometry = new RectangleGeometry(); geometry.Rect = new Windows.Foundation.Rect { Width = 5, Height = 2, X = 0, Y = 0 }; pathIconSource.Data = geometry; animatedIconSource = new AnimatedIconSource(); animatedIconSource.Source = new AnimatedSettingsVisualSource(); Content = infoBadge; Content.UpdateLayout(); }); IdleSynchronizer.Wait(); RunOnUIThread.Execute(() => { Log.Comment("Switch to Symbol Icon"); infoBadge.IconSource = symbolIconSource; Content.UpdateLayout(); Log.Comment("Switch to Path Icon"); infoBadge.IconSource = pathIconSource; Content.UpdateLayout(); Log.Comment("Switch to Font Icon"); infoBadge.IconSource = fontIconSource; Content.UpdateLayout(); Log.Comment("Switch to bitmap Icon"); infoBadge.IconSource = bitmapIconSource; Content.UpdateLayout(); Log.Comment("Switch to Image Icon"); infoBadge.IconSource = imageIconSource; Content.UpdateLayout(); Log.Comment("Switch to Animated Icon"); infoBadge.IconSource = animatedIconSource; Content.UpdateLayout(); }); }