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
295
Setting alternate colors by code.
posted

I am using behaviors to provide custome settings to Xamdatagrid. i want to know how can i set the alternate and selected records background and foregrounds as these are the parts of DataRecordCellArea and CellValuePresenteri can change them by  setting binding on them but in my case i cann't use the binding for them so i need to write the behaviors and set the properties .

 

can somebody guide me how can i set the altername and selected foreground colors while i already have default style created for my template and need to change the values at runtime by code using behviors.

Parents
  • 138253
    Offline posted

    Hello,

    Thank you for your post. I have been looking into it and I can say that you can iterate trough the Records and you can use the CellValuePresenter’s static method FromCell and get the Cell’s CVP. The DataRecordPresenter has FromRecord static method which returns the DRP of the Record and you can use the following code to get the DRCA:

    Utilities.GetDescendantFromType(drp, typeof(DataRecordCellArea),true);

    Where “drp” is the DRP. After doing this you can set the colors you want. Please let me know if this helps you or you need further assistance on this matter.

    Looking forward for your reply.

Reply Children