DataTrigger on a specific Type

I have a scenario where I need to specify Functions like

void SomeFunction(int value)

For this I'm using two DataGrids.

  • The left DataGrid holds the Functions
  • The right DataGrid holds the Parameters for the selected Function

I only want the Parameter DataGrid to be enabled when a valid Function is selected in the Function DataGrid. If the NewItemPlaceHolder (the Last Row when CanUserAddRows="True" for a DataGrid) is selected or if the selection is empty I want it to be disabled. I experimentet with a DataTrigger but I couldn't get it to work

<Style TargetType="DataGrid">
    <Setter Property="IsEnabled" Value="False"/>
    <Style.Triggers>
        <DataTrigger Binding="{Binding ElementName=functionDataGrid,
                                       Path=SelectedItem}"
                     Value="{x:Type systemData:DataRowView}">
            <Setter Property="IsEnabled" Value="True"/>
        </DataTrigger>
    </Style.Triggers>
</Style>

Is it possible to check if the value produced by the Binding is of a specific Type? Otherwise, does anyone have any other solutions to this? As of now, I'm handling this with the SelectedCellsChanged event but I would prefer not using code behind

Thanks

7
задан Fredrik Hedblad 23 February 2011 в 14:03
поделиться