Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
40
DataTrigger & Converter sometimes work accurately but sometime not
posted

Hi,

I am setting background and foreground color on basis of content using DataRecordCellArea style.

i tried it using DataTrgiggers & as well as using converter ( custom value converter ) but it some time work fine, some time not.

for your information i am also sorting record on basis of time, for this i am calling RefreshSortPosition on InitializeRecord event.

one thing i had observed is when i stop sorting. foreground and background color seems to correct, but issue occur when i start sorting as well.

Is style have any connection with record position ?

please help !!

Thanks,

Parents
No Data
Reply
  • 2151
    Offline posted

    Hello Narender,

    I am attaching a sample demonstrating how to set foreground and background colors using both converters and data triggers. It is best to use data triggers when you set a color based on an exact value. Converters are better when you need to set a color based on a condition (for example greater than a specific value). Also the sorting seems to be working when clicking on the columns' headers. If your data source's data is constantly changing please make sure you implement correctly the INotifyPropertyChanged interface on your data item's type.

    Please let me know if I can be of any further assistance.

    Sincerely,
    Radko Kolev
    Senior Software Developer

    WpfApplication1.zip
Children