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
348
Change colors and style of columns through code
posted

Hi,

    I need your help in column formating. I want to change the colors and style of particular column thru code. I am binding my xamdatagrid with dataset. IN xaml, I don't know how many fields the dataset return. Can you please help me to send the code how I can format particular column at runtime.

Thanks & Regards,

Mukesh

Parents
No Data
Reply
  • 69686
    Suggested Answer
    posted

    Hello Mukesh,

    The CellValuePresenter is the visual representation of the cell, so if you want to do some styling/formatting you should target that element. Each field exposes a CellValuePresenterStyle property so you can set the style there. You can also retrieve the CVP of a cell by calling the static method CellValuePresenter.FromCell(...) and directly set its Background, FontWeight, etc. properties.

    You can also use IValueConverter to style a cell depending on some conditions.

Children
No Data