原創|使用教程|編輯:龔雪|2020-07-13 10:43:24.650|閱讀 443 次
概述:通過DevExpress WPF Controls,您能創建有著強大互動功能的XAML基礎應用程序,本文將為大家介紹如何更改DataBarFormatConditions中的填充顏色。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
下載DevExpress v20.1完整版 DevExpress v20.1漢化資源獲取
通過DevExpress WPF Controls,您能創建有著強大互動功能的XAML基礎應用程序,這些應用程序專注于當代客戶的需求和構建未來新一代支持觸摸的解決方案。
在網格中有2列 - Side和Percentage Done,想添加類似條的內容來直觀地指示完成的百分比以及當前顯示的數字,同時還想通過在下面的代碼中添加FormatCondition來更改基于"Side"值的顏色(以下內容將無法正常工作,因為該條相對于其他條顯示)。
var dataBarPercentDoneFormatCondition = new DataBarFormatCondition { FieldName = nameof(PercentDone), PredefinedFormatName = "GreenSolidDataBar" // I want the color to be red if the "side" is "sell" and green if its "buy" };
這個問題如何解決呢?
在這種情況下,您需要定義兩個具有不同SelectiveExpression值的DataBarFormatCondition元素。 這些值使您可以指定何時顯示某些DataBarFormatCondition:
<dxg:DataBarFormatCondition FieldName="PercentageDone" SelectiveExpression="[Side] = 'Sell'" PredefinedFormatName="GreenSolidDataBar" /> <dxg:DataBarFormatCondition FieldName="PercentageDone" SelectiveExpression="[Side] = 'Buy'" PredefinedFormatName="RedSolidDataBar" />
DevExpress技術交流群2:775869749 歡迎一起進群討論
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自:慧都網