How I can get all colors in OxyPlot?

荒凉一梦 提交于 2019-12-02 21:44:12

问题


I have a one question. I use OxyPlot in WPF, C#. I need to have all colors to MarkerType and MarkerStroke for series. How I can get all colors?


回答1:


Green, IndianRed, etc are static fields in static OxyColors class. use reflection to read all of them

var colors = typeof(OxyColors)
             .GetFields(BindingFlags.Static | BindingFlags.Public)
             .Where(f => f.FieldType == typeof(OxyColor))
             .Select(f => f.GetValue(null))
             .Cast<OxyColor>()
             .ToList();


来源:https://stackoverflow.com/questions/50602161/how-i-can-get-all-colors-in-oxyplot

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!