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
1405
AddNewRecord
posted

Hi,

I am adding a new record to my xamdatagrid. But during the record initialization I want to access the last cell and make the button control invisible. Can someone please suggest when and how can I access or change the style of newly added record before it is visible to the user.

Thanks,

Megha

  • 138253
    Offline posted

    Hello Megha,

     

    I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.

  • 138253
    Offline posted

    Hello Megha,

     

    Thank you for your post. I have been looking into it and I suggest you create a Style for the CellValuePresenter and handle its Loaded event like this:

    <Style TargetType="igDP:CellValuePresenter">
        <EventSetter Event="Loaded" Handler="cvpLoaded"/>
    </Style>
    

    And add the following handler:

    private void cvpLoaded(object sender, RoutedEventArgs e)
    {
        if ((sender as CellValuePresenter).Field.Index == (sender as CellValuePresenter).Field.Owner.Fields.Count-1)
        {
            //Here you can get the CellValuePresenter and modify it
            (sender as CellValuePresenter).Background = Brushes.Red;
        }
    }
    

    Please let me know if this helps you or you need further assistance on this matter.

     

    Looking forward for your reply.