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
605
Hidding Button in AddNew-Row
posted

Hi,

I have created an UnboundField with a ControlTamplate and a button in it.

This Button is used to delete a Row. I would like to hide this button in the AddNew-Row because it doesn't make sence to delete a not existing Row.

Do you have an Idea how to solve this Problem?

Here is the Code of the Column:

<igDP:UnboundField Name="">

 

 

 

 

 

 

<igDP:UnboundField.Settings>

<igDP:FieldSettings CellClickAction="Default" AllowEdit="False" AllowGroupBy="False">

 

 

 

<igDP:FieldSettings.CellValuePresenterStyle>

 

 

<Style TargetType="{x:Type igDP:CellValuePresenter}">

 

 

 

 

<Setter Property="Template">

 

 

 

<Setter.Value>

 

 

<ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}">

 

 

<Button Click="dg_belege_delete_click">x</Button>

 

 

</ControlTemplate>

 

 

</Setter.Value>

 

 

 

 

</Setter>

 

 

</Style>

 

 

</igDP:FieldSettings.CellValuePresenterStyle>

 

 

</igDP:FieldSettings>

 

 

</igDP:UnboundField.Settings>

 

 

</igDP:UnboundField>

 

 

 

 

 

Yourse sincerealy

Thomas

 

Parents
No Data
Reply
  • 69686
    Verified Answer
    posted

    Hello Thomas,

    You can do this by creating a Trigger/DataTrigger and check for the IsAddRecord property of the DataRecordPresenter and if it is true, hide the button. You can use something like this:

                            <ControlTemplate.Triggers>

                                <DataTrigger Binding="{Binding Path=IsAddRecord}" Value="True">

                                    <Setter Property="Visibility" TargetName="delImage" Value="Collapsed"/>

                                </DataTrigger>

                            </ControlTemplate.Triggers>

    where your target name would be the name of the button.

    Hope this helps.

Children
No Data