wpf 后台使用图标字体

文本控件 text= IconFontModel.GetIconFont(枚举类) 这个用ai完成就可以了

iconfont= IconFontModel.GetIconFont((IconFontModel.IconType)i) + " \n" ;

xaml 绑定: <TextBlock FontFamily="../#iconfont" FontSize ="50" Foreground="{DynamicResource PrimaryBrush}" Text="{Binding iconfont}" />

字体的属性设置为resource

复制代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace you.Models
{
    internal class IconFontModel
    {


        public enum IconType
        {
            // 搜索 
            shousuo = 1,
            // 删除 
            shanchu = 2,
            // 修改 
            xiugai = 3,
            // 添加 
            tianjia = 4,
            // 首页 
            shouye = 5,
            // 资源 
            ziyuan = 6,
            // 下载 
            xiazai = 7,
            // 验出 
            yanchu = 8,
            // 审核 
            jiaose = 9,
            // 箭头 
            jiantou = 10,
            // 刷新 
            shuaxin1 = 11,
            // 导出 
            daochu = 12,
            // 导入 
            daoru = 13,
            // 打印 
            dingdan = 14,
            // 帮助 
            bangzhu = 15,
            // 关于 
            guanyu = 16,
            // 退出 
            tuichu = 17,
            // 登录 
            denglu = 18,
            // 注册 
            zhuce = 19,
            // 保存 
            baocun = 20,
            // 取消 
            quxiao = 21,
            // 确认 
            queren = 22,
            // 关闭 
            guanbi = 23,
            // 确定 
            queding = 24,
            // 编辑 
            bianji = 25,
            // 复制 
            fuyin = 26,
            // 剪切 
            jiecut = 27,
            // 粘贴 
            jianpast = 28,
            // 全选 
            quanxuan = 29,
            // 其他图标 
            shoucang = 30,
            BBD_sort1 = 31,
            BBD_left = 32,
            BBD_back = 33,
            BBD_comment = 34,
            BBD_remind = 35,
            BBD_feedback = 36,
            BBD_flag = 37,
            system_config = 38,
            folder = 39,
            hide = 40,
            notepad = 41,
            game = 42,
            open_file = 43,
            paste = 44,
            android = 45,
            apple_fill = 46,
            show = 47,
            usb = 48,
            linux = 49,
            agree = 50,
            system_user = 51,
            exit_system = 52,
            personnel_system = 53,
            system_info = 54,
            item_notepad = 55,
            system_management = 56,
            picture = 57,
            upload = 58,
            system_settings = 59,
            warning = 60,
            layer = 61,
            system_notice = 62,
            hacker = 63,
            QQ = 64,
            KHCFDC_picture = 65,
            flatten = 66,
            word = 67,
            toolbox_jurassic = 68,
            clipboard_paste = 69,
            bg_display = 70,
            thunder = 71,
            flag = 72,
            Word_color = 73,
            Word_filled = 74,
            command_mark = 75,
            move_folder = 76,
            order = 77,
            wechat = 78,
            announcement = 79,
            menu = 80,
            ok = 81,
            download = 82,
            space = 83,
            cog = 84,
            location_fill = 85,
            image = 86,
            info_fill = 87,
            close_fill = 88,
            round_add_fill = 89,
            question = 90,
            up_arrow = 91,
            right_arrow = 92,
            replace = 93,
            icon7 = 94,
            ihou = 95,
            tool = 96,
            bookmark = 97,
            diamond = 98,
            home = 99,
            wine = 100,
            tracking = 101,
            bicycle = 102,
            law = 103,
            mailbox = 104,
            inspiration = 105,
            suitcase = 106,
            information_management = 107,
            degree_cap = 108,
            department = 109,
            travel = 110,
            nearby = 111,
            leaf = 112,
            bank = 113,
            birthday = 114,
            code = 115,
            credit = 116,
            seal = 117,
            car = 118,
            network = 119,
            correct = 120,
            bluetooth = 121,
            calculation = 122,
            cloud = 123,
            scatter = 124,
            battery = 125,
            water_drop = 126,
            file = 127,
            database = 128,
            police_badge = 129,
            exit_fullscreen = 130,
            RFID = 131,
            repayment = 132,
            umbrella = 133,
            video = 134,
            news = 135,
            customer_service = 136,
            classification = 137,
            funnel = 138,
            system = 139,
            setting = 140,
            book = 141,
            puzzle = 142,
            NFC = 143,
            task = 144,
            fingerprint = 145,
            shopping_cart = 146,
            share = 147,
            plan = 148,
            clear = 149,
            browser = 150,
            link = 151,
            edit = 152,
            mute = 153,
            time = 154,
            about = 155,
            document = 156,
            scan = 157,
            microphone = 158,
            message = 159,
            double_left_arrow = 160,
            message1 = 161,
            data_statistics = 162,
            volume = 163,
            file1 = 164,
            statistical_analysis = 165,
            home1 = 166,
            favorite = 167,
            refresh1 = 168,
            required = 169,
            view_search = 170,
            information = 171,
            home2 = 172,
            setting1 = 173,
            location = 174,
            brand = 175,
            left = 176,
            up = 177,
            mine = 178,
            right = 179,
            like = 180,
            menu1 = 181,
            history = 182,
            search1 = 183,
            down = 184,
            notification = 185,
            edit1 = 186,
            phone = 187,
            modify = 188,
            customer_service1 = 189,
            share1 = 190,
            star = 191,
            description = 192,
            notification1 = 193,
            file2 = 194,
            crown = 195,
            browse = 196,
            gift = 197,
            classification1 = 198,
            shop = 199,
            picture1 = 200,
            certification = 201,
            delete1 = 202,
            archive = 203,
            upload1 = 204,
            download1 = 205,
            close1 = 206,
            filter = 207,
            card = 208,
            zoom_out = 209,
            export = 210,
            focus = 211,
            zoom_in = 212,
            calendar = 213,
            lock1 = 214,
            unlock = 215,
            computer = 216,
            label = 217,
            crop = 218,
            copy1 = 219,
            pause = 220,
            add = 221,
            multi_select_checked = 222,
            basketball = 223,
            multi_select = 224,
            file3 = 225,
            play = 226,
            single_select_checked = 227,
            single_select = 228,
            compare = 229,
            correct1 = 230,
            theme = 231,
            compass = 232,
            help = 233,
            import = 234,
            navigation = 235,
            refresh2 = 236,
            exchange = 237,
            balloon = 238,
            pie_chart = 239,
            sticky_note = 240,
            blood_donation = 241,
            exit1 = 242,
            bar_chart = 243,
            print = 244,
            email = 245,
            shopping_bag = 246,
            top = 247,
            scissors = 248,
            details = 249,
            airplane = 250,
            smile = 251,
            user_query = 252,
            building = 253,
            hide1 = 254,
            file_query = 255,
            file_approval = 256,
            washing_machine = 257,
            like1 = 258,
            address_book = 259,
            food = 260,
            collaboration = 261,
            file_collection = 262,
            wallet = 263,
            WiFi = 264,
            system_management1 = 265,
            video_call = 266,
            column_management = 267,
            medical = 268,
            map = 269,
            error = 270,
            committee = 271,
            configuration = 272,
            operation_service = 273,
            arrow = 274,
            dashboard = 275,
            fire = 276,
            link1 = 277,
            usage_statistics = 278,
            security_settings = 279,
            down1 = 280,
            reset = 281,
            refresh3 = 282,
            personal_center = 283,
            right1 = 284,
            show1 = 285
        }







        public static string GetIconFont(IconType iconType)
        {
            switch (iconType)
            {
                case IconType.shousuo:
                    return "\xe604";
                case IconType.shanchu:
                    return "\xe664";
                case IconType.xiugai:
                    return "\xe8df";
                case IconType.tianjia:
                    return "\xe900";
                case IconType.shouye:
                    return "\xe8cf";
                case IconType.ziyuan:
                    return "\xe602";
                case IconType.xiazai:
                    return "\xe603";
                case IconType.yanchu:
                    return "\xe604";
                case IconType.jiaose:
                    return "\xe607";
                case IconType.jiantou:
                    return "\xe608";
                case IconType.shuaxin1:
                    return "\xe609";
                case IconType.daochu:
                    return "\xe60a";
                case IconType.daoru:
                    return "\xe60b";
                case IconType.dingdan:
                    return "\xe60c";
                case IconType.bangzhu:
                    return "\xe60d";
                case IconType.guanyu:
                    return "\xe60e";
                case IconType.tuichu:
                    return "\xe60f";
                case IconType.denglu:
                    return "\xe610";
                case IconType.zhuce:
                    return "\xe611";
                case IconType.baocun:
                    return "\xe665";
                case IconType.quxiao:
                    return "\xe612";
                case IconType.queren:
                    return "\xe613";
                case IconType.guanbi:
                    return "\xe614";
                case IconType.queding:
                    return "\xe615";
                case IconType.bianji:
                    return "\xe616";
                case IconType.fuyin:
                    return "\xe617";
                case IconType.jiecut:
                    return "\xe618";
                case IconType.jianpast:
                    return "\xe619";
                case IconType.quanxuan:
                    return "\xe61a";
                case IconType.shoucang:
                    return "\xe64a";
                case IconType.BBD_sort1:
                    return "\xe64b";
                case IconType.BBD_left:
                    return "\xe64c";
                case IconType.BBD_back:
                    return "\xe64d";
                case IconType.BBD_comment:
                    return "\xe64e";
                case IconType.BBD_remind:
                    return "\xe64f";
                case IconType.BBD_feedback:
                    return "\xe650";
                case IconType.BBD_flag:
                    return "\xe651";
                case IconType.system_config:
                    return "\xe669";
                case IconType.folder:
                    return "\xe6e6";
                case IconType.hide:
                    return "\xe652";
                case IconType.notepad:
                    return "\xe605";
                case IconType.game:
                    return "\xe653";
                case IconType.open_file:
                    return "\xe654";
                case IconType.paste:
                    return "\xe780";
                case IconType.android:
                    return "\xe87e";
                case IconType.apple_fill:
                    return "\xe881";
                case IconType.show:
                    return "\xe655";
                case IconType.usb:
                    return "\xe656";
                case IconType.linux:
                    return "\xf1e8";
                case IconType.agree:
                    return "\xe688";
                case IconType.system_user:
                    return "\xe658";
                case IconType.exit_system:
                    return "\xe659";
                case IconType.personnel_system:
                    return "\xe65b";
                case IconType.system_info:
                    return "\xe835";
                case IconType.item_notepad:
                    return "\xe714";
                case IconType.system_management:
                    return "\xe683";
                case IconType.picture:
                    return "\xe695";
                case IconType.upload:
                    return "\xeb11";
                case IconType.system_settings:
                    return "\xe69b";
                case IconType.warning:
                    return "\xe65c";
                case IconType.layer:
                    return "\xe6b2";
                case IconType.system_notice:
                    return "\xe65e";
                case IconType.hacker:
                    return "\xe6a9";
                case IconType.QQ:
                    return "\xe667";
                case IconType.KHCFDC_picture:
                    return "\xe6de";
                case IconType.flatten:
                    return "\xe663";
                case IconType.word:
                    return "\xe716";
                case IconType.toolbox_jurassic:
                    return "\xe6a3";
                case IconType.clipboard_paste:
                    return "\xe70b";
                case IconType.bg_display:
                    return "\xe66a";
                case IconType.thunder:
                    return "\xe671";
                case IconType.flag:
                    return "\xe9f5";
                case IconType.Word_color:
                    return "\xe678";
                case IconType.Word_filled:
                    return "\xe747";
                case IconType.command_mark:
                    return "\xe67c";
                case IconType.move_folder:
                    return "\xe67d";
                case IconType.order:
                    return "\xe601";
                case IconType.wechat:
                    return "\xe660";
                case IconType.announcement:
                    return "\xe632";
                case IconType.menu:
                    return "\xe607";
                case IconType.ok:
                    return "\xe606";
                case IconType.download:
                    return "\xe633";
                case IconType.space:
                    return "\xe636";
                case IconType.cog:
                    return "\xe637";
                case IconType.location_fill:
                    return "\xe639";
                case IconType.image:
                    return "\xe63a";
                case IconType.info_fill:
                    return "\xe613";
                case IconType.close_fill:
                    return "\xe63d";
                case IconType.round_add_fill:
                    return "\xe63e";
                case IconType.question:
                    return "\xe614";
                case IconType.up_arrow:
                    return "\xe63f";
                case IconType.right_arrow:
                    return "\xe640";
                case IconType.replace:
                    return "\xe641";
                case IconType.icon7:
                    return "\xe642";
                case IconType.ihou:
                    return "\xe643";
                case IconType.tool:
                    return "\xe615";
                case IconType.bookmark:
                    return "\xe646";
                case IconType.diamond:
                    return "\xe67a";
                case IconType.home:
                    return "\xe647";
                case IconType.wine:
                    return "\xe649";
                case IconType.tracking:
                    return "\xe939";
                case IconType.bicycle:
                    return "\xe93a";
                case IconType.law:
                    return "\xe93b";
                case IconType.mailbox:
                    return "\xe93c";
                case IconType.inspiration:
                    return "\xe93d";
                case IconType.suitcase:
                    return "\xe93e";
                case IconType.information_management:
                    return "\xe93f";
                case IconType.degree_cap:
                    return "\xe940";
                case IconType.department:
                    return "\xe941";
                case IconType.travel:
                    return "\xe942";
                case IconType.nearby:
                    return "\xe943";
                case IconType.leaf:
                    return "\xe944";
                case IconType.bank:
                    return "\xe945";
                case IconType.birthday:
                    return "\xe946";
                case IconType.code:
                    return "\xe948";
                case IconType.credit:
                    return "\xe949";
                case IconType.seal:
                    return "\xe94a";
                case IconType.car:
                    return "\xe94b";
                case IconType.network:
                    return "\xe94d";
                case IconType.correct:
                    return "\xe94e";
                case IconType.bluetooth:
                    return "\xe94f";
                case IconType.calculation:
                    return "\xe950";
                case IconType.cloud:
                    return "\xe951";
                case IconType.scatter:
                    return "\xe952";
                case IconType.battery:
                    return "\xe953";
                case IconType.water_drop:
                    return "\xe954";
                case IconType.file:
                    return "\xe955";
                case IconType.database:
                    return "\xe956";
                case IconType.police_badge:
                    return "\xe957";
                case IconType.exit_fullscreen:
                    return "\xe958";
                case IconType.RFID:
                    return "\xe959";
                case IconType.repayment:
                    return "\xe95b";
                case IconType.umbrella:
                    return "\xe95c";
                case IconType.video:
                    return "\xe95d";
                case IconType.news:
                    return "\xe95e";
                case IconType.customer_service:
                    return "\xe95f";
                case IconType.classification:
                    return "\xe960";
                case IconType.funnel:
                    return "\xe961";
                case IconType.system:
                    return "\xe962";
                case IconType.setting:
                    return "\xe963";
                case IconType.book:
                    return "\xe964";
                case IconType.puzzle:
                    return "\xe965";
                case IconType.NFC:
                    return "\xe966";
                case IconType.task:
                    return "\xe967";
                case IconType.fingerprint:
                    return "\xe968";
                case IconType.shopping_cart:
                    return "\xe618";
                case IconType.share:
                    return "\xe619";
                case IconType.plan:
                    return "\xe61a";
                case IconType.clear:
                    return "\xe61b";
                case IconType.browser:
                    return "\xe61c";
                case IconType.link:
                    return "\xe61d";
                case IconType.edit:
                    return "\xe61f";
                case IconType.mute:
                    return "\xe620";
                case IconType.time:
                    return "\xe621";
                case IconType.about:
                    return "\xe622";
                case IconType.document:
                    return "\xe623";
                case IconType.scan:
                    return "\xe625";
                case IconType.microphone:
                    return "\xe626";
                case IconType.message:
                    return "\xe627";
                case IconType.double_left_arrow:
                    return "\xe628";
                case IconType.message1:
                    return "\xe629";
                case IconType.data_statistics:
                    return "\xe62a";
                case IconType.volume:
                    return "\xe62b";
                case IconType.file1:
                    return "\xe62c";
                case IconType.statistical_analysis:
                    return "\xe62d";
                case IconType.home1:
                    return "\xe62e";
                case IconType.favorite:
                    return "\xe62f";
                case IconType.refresh1:
                    return "\xe630";
                case IconType.required:
                    return "\xe631";
                case IconType.view_search:
                    return "\x100ac";
                case IconType.information:
                    return "\xe8ce";
                case IconType.home2:
                    return "\xe8cf";
                case IconType.setting1:
                    return "\xe8d0";
                case IconType.location:
                    return "\xe8d1";
                case IconType.brand:
                    return "\xe8d2";
                case IconType.left:
                    return "\xe8d3";
                case IconType.up:
                    return "\xe8d4";
                case IconType.mine:
                    return "\xe8d5";
                case IconType.right:
                    return "\xe8d6";
                case IconType.like:
                    return "\xe8d7";
                case IconType.menu1:
                    return "\xe8d8";
                case IconType.history:
                    return "\xe8d9";
                case IconType.search1:
                    return "\xe8da";
                case IconType.down:
                    return "\xe8db";
                case IconType.notification:
                    return "\xe8dc";
                case IconType.edit1:
                    return "\xe8dd";
                case IconType.phone:
                    return "\xe8de";
                case IconType.modify:
                    return "\xe8df";
                case IconType.customer_service1:
                    return "\xe8e0";
                case IconType.share1:
                    return "\xe8e1";
                case IconType.star:
                    return "\xe8e2";
                case IconType.description:
                    return "\xe8e3";
                case IconType.notification1:
                    return "\xe8e4";
                case IconType.file2:
                    return "\xe8e5";
                case IconType.crown:
                    return "\xe8e6";
                case IconType.browse:
                    return "\xe8e7";
                case IconType.gift:
                    return "\xe8e8";
                case IconType.classification1:
                    return "\xe8e9";
                case IconType.shop:
                    return "\xe8ea";
                case IconType.picture1:
                    return "\xe8eb";
                case IconType.certification:
                    return "\xe8ec";
                case IconType.delete1:
                    return "\xe8ed";
                case IconType.archive:
                    return "\xe8ee";
                case IconType.upload1:
                    return "\xe8ef";
                case IconType.download1:
                    return "\xe8f0";
                case IconType.close1:
                    return "\xe8f1";
                case IconType.filter:
                    return "\xe8f2";
                case IconType.card:
                    return "\xe8f3";
                case IconType.zoom_out:
                    return "\xe8f4";
                case IconType.export:
                    return "\xe8f5";
                case IconType.focus:
                    return "\xe8f6";
                case IconType.zoom_in:
                    return "\xe8f7";
                case IconType.calendar:
                    return "\xe8f8";
                case IconType.lock1:
                    return "\xe8f9";
                case IconType.unlock:
                    return "\xe8fa";
                case IconType.computer:
                    return "\xe8fb";
                case IconType.label:
                    return "\xe8fc";
                case IconType.crop:
                    return "\xe8fd";
                case IconType.copy1:
                    return "\xe8fe";
                case IconType.pause:
                    return "\xe8ff";
                case IconType.add:
                    return "\xe900";
                case IconType.multi_select_checked:
                    return "\xe901";
                case IconType.basketball:
                    return "\xe902";
                case IconType.multi_select:
                    return "\xe903";
                case IconType.file3:
                    return "\xe904";
                case IconType.play:
                    return "\xe905";
                case IconType.single_select_checked:
                    return "\xe906";
                case IconType.single_select:
                    return "\xe907";
                case IconType.compare:
                    return "\xe908";
                case IconType.correct1:
                    return "\xe909";
                case IconType.theme:
                    return "\xe90a";
                case IconType.compass:
                    return "\xe90b";
                case IconType.help:
                    return "\xe90c";
                case IconType.import:
                    return "\xe90d";
                case IconType.navigation:
                    return "\xe90e";
                case IconType.refresh2:
                    return "\xe90f";
                case IconType.exchange:
                    return "\xe910";
                case IconType.balloon:
                    return "\xe911";
                case IconType.pie_chart:
                    return "\xe912";
                case IconType.sticky_note:
                    return "\xe913";
                case IconType.blood_donation:
                    return "\xe914";
                case IconType.exit1:
                    return "\xe915";
                case IconType.bar_chart:
                    return "\xe916";
                case IconType.print:
                    return "\xe917";
                case IconType.email:
                    return "\xe918";
                case IconType.shopping_bag:
                    return "\xe919";
                case IconType.top:
                    return "\xe91a";
                case IconType.scissors:
                    return "\xe91b";
                case IconType.details:
                    return "\xe91c";
                case IconType.airplane:
                    return "\xe91d";
                case IconType.smile:
                    return "\xe91e";
                case IconType.user_query:
                    return "\xe91f";
                case IconType.building:
                    return "\xe920";
                case IconType.hide1:
                    return "\xe921";
                case IconType.file_query:
                    return "\xe922";
                case IconType.file_approval:
                    return "\xe923";
                case IconType.washing_machine:
                    return "\xe924";
                case IconType.like1:
                    return "\xe925";
                case IconType.address_book:
                    return "\xe926";
                case IconType.food:
                    return "\xe927";
                case IconType.collaboration:
                    return "\xe928";
                case IconType.file_collection:
                    return "\xe929";
                case IconType.wallet:
                    return "\xe92a";
                case IconType.WiFi:
                    return "\xe92b";
                case IconType.system_management1:
                    return "\xe92c";
                case IconType.video_call:
                    return "\xe92d";
                case IconType.column_management:
                    return "\xe92e";
                case IconType.medical:
                    return "\xe92f";
                case IconType.map:
                    return "\xe930";
                case IconType.error:
                    return "\xe931";
                case IconType.committee:
                    return "\xe932";
                case IconType.configuration:
                    return "\xe933";
                case IconType.operation_service:
                    return "\xe934";
                case IconType.arrow:
                    return "\xe935";
                case IconType.dashboard:
                    return "\xe936";
                case IconType.fire:
                    return "\xe937";
                case IconType.link1:
                    return "\xe938";
                case IconType.usage_statistics:
                    return "\xe609";
                case IconType.security_settings:
                    return "\xe60a";
                case IconType.down1:
                    return "\xe60b";
                case IconType.reset:
                    return "\xe60c";
                case IconType.refresh3:
                    return "\xe60d";
                case IconType.personal_center:
                    return "\xe60e";
                case IconType.right1:
                    return "\xe60f";
                case IconType.show1:
                    return "\xe610";
                default:
                    return null;
            }
        }

    }
}
相关推荐
FuckPatience1 天前
WPF 具有跨线程功能的UI元素
wpf
诗仙&李白1 天前
HEFrame.WpfUI :一个现代化的 开源 WPF UI库
ui·开源·wpf
He BianGu2 天前
【笔记】在WPF中Binding里的详细功能介绍
笔记·wpf
He BianGu2 天前
【笔记】在WPF中 BulletDecorator 的功能、使用方式并对比 HeaderedContentControl 与常见 Panel 布局的区别
笔记·wpf
123梦野3 天前
WPF——效果和可视化对象
wpf
He BianGu3 天前
【笔记】在WPF中Decorator是什么以及何时优先考虑 Decorator 派生类
笔记·wpf
时光追逐者3 天前
一款专门为 WPF 打造的开源 Office 风格用户界面控件库
ui·开源·c#·.net·wpf
He BianGu3 天前
【笔记】介绍 WPF XAML 中 Binding 的 StringFormat详细功能
笔记·wpf
Rotion_深4 天前
C# WPF使用线程池运行Action方法
c#·wpf·线程池
攻城狮CSU4 天前
WPF 深入系列.2.布局系统.尺寸属性
wpf