{"id":5596,"date":"2021-11-16T17:01:42","date_gmt":"2021-11-16T16:01:42","guid":{"rendered":"https:\/\/solidt.eu\/site\/?p=5596"},"modified":"2021-11-16T17:01:43","modified_gmt":"2021-11-16T16:01:43","slug":"devexpress-report-style-binding","status":"publish","type":"post","link":"https:\/\/solidt.eu\/site\/devexpress-report-style-binding\/","title":{"rendered":"DevExpress Report Style binding"},"content":{"rendered":"\n<p>First add styles to the report:<\/p>\n\n\n\n<p><a href=\"https:\/\/docs.devexpress.com\/XtraReports\/119473\/detailed-guide-to-devexpress-reporting\/shape-report-data\/specify-conditions-for-report-elements\/conditionally-change-a-controls-appearance\">https:\/\/docs.devexpress.com\/XtraReports\/119473\/detailed-guide-to-devexpress-reporting\/shape-report-data\/specify-conditions-for-report-elements\/conditionally-change-a-controls-appearance<\/a><\/p>\n\n\n\n<p>Add the databinding to the report (eg in beforeprint) for the detail band<\/p>\n\n\n\n<div style=\"height: 250px; position:relative; margin-bottom: 50px;\" class=\"wp-block-simple-code-block-ace\"><pre class=\"wp-block-simple-code-block-ace\" style=\"position:absolute;top:0;right:0;bottom:0;left:0\" data-mode=\"csharp\" data-theme=\"monokai\" data-fontsize=\"14\" data-lines=\"Infinity\" data-showlines=\"true\" data-copy=\"false\">\/\/ XPO Object\npublic class SampleAnalysisItem : XPCustomObject\n{\n\t[Browsable(false)]\n\t[NonPersistent]\n\tpublic string ReportStyleName => IsOffSpec ? \"xrControlStyleOffspec\" : \"xrControlStyleNormal\";\n}\n\npublic class CustomReport : DevExpress.XtraReports.UI.XtraReport\n{\n\tpublic CustomReport()\n\t{\n\t\tBeforePrint += CustomReport_BeforePrint;\n\t\t\/\/ set the datasource\n\t\tDataSource = new List&lt;SampleAnalysisItem>();\n\t}\n\n\tprivate void CustomReport_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)\n\t{\n\t\tif (GetCurrentRow() is SampleAnalysis obj)\n\t\t{\n\t\t\txrTableRow10.DataBindings.Add(\"StyleName\", DataSource, nameof(SampleAnalysisItem.ReportStyleName));\n\t\t}\n\t}\n}<\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>First add styles to the report: https:\/\/docs.devexpress.com\/XtraReports\/119473\/detailed-guide-to-devexpress-reporting\/shape-report-data\/specify-conditions-for-report-elements\/conditionally-change-a-controls-appearance Add the databinding to the report (eg in beforeprint) for the detail band<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5596","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts\/5596","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/comments?post=5596"}],"version-history":[{"count":1,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts\/5596\/revisions"}],"predecessor-version":[{"id":5597,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts\/5596\/revisions\/5597"}],"wp:attachment":[{"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/media?parent=5596"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/categories?post=5596"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/tags?post=5596"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}