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
1415
XamDataGrid retrieve overridden CellValuePresenterValueStyle
posted

When a cell is selected, I would like to programatically (in C#) check if it has been assigned an overridden style named "MyLocalStyle" 

I'm trying to accomplish this in the SelectedItemsChanged Event

<dataPresenter:Field Name="total_flows" >
                                        <dataPresenter:Field.Settings>
                                            <dataPresenter:FieldSettings CellValuePresenterStyle="{StaticResource MyLocalSyle}"/>
                                        </dataPresenter:Field.Settings>
                                    </dataPresenter:Field>

  • 1500
    Verified Answer
    Offline posted

    Hello,

    In case it comes down to single cell, I can suggest using CellActivated Event, as SelectedItemsChanged will return a collection and you will have to iterate trough it. 

    In order to retrieve the cell, you can use the CellValuePresenter's method FromCell, and check if it matches to your custom one:

    private void xamDataGrid1_CellActivated(object sender, Infragistics.Windows.DataPresenter.Events.CellActivatedEventArgs e)
            {
                var isStyleApplied = CellValuePresenter.FromCell(e.Cell).Style == MyLocalStyle;
            }

    Should you have any further questions, please let me know.

    Sincerely,
    Tihomir Tonev
    Associate Software Developer
    Infragistics