Beispiel #1
0
        public static IXamlDirect GetXamlDirectForWindow(CoreDispatcher dispatcher)
        {
            int hash = dispatcher.GetHashCode();

            if (_xamlDirectCache.TryGetValue(hash, out IXamlDirect d))
            {
                return(d);
            }

            d = XamlDirect.GetDefault();
            _xamlDirectCache[hash] = d;
            return(d);
        }
        public static IconElement GetGlyph(string glyph)
        {
            var direct = XamlDirect.GetDefault();

            if (direct.IsXamlDirectEnabled)
            {
                var icon = direct.CreateInstance(XamlTypeIndex.FontIcon);
                direct.SetStringProperty(icon, XamlPropertyIndex.FontIcon_Glyph, glyph);

                return(direct.GetObject(icon) as FontIcon);
            }
            else
            {
                return(new FontIcon {
                    Glyph = glyph
                });
            }
        }