This is not a complete answer since you have not posted any relevant code , but i hope this will lead you on the right path .
I don't know from where you are adding a row , but you can influence the ability to do so in this manner :
CS :
public enum EBillType
{
Direct , PO
};
public class BillTypeToBooleanConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
EBillType billType = (EBillType)value;
return billType == EBillType.PO;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
xaml :
<Window.Resources>
<ObjectDataProvider x:Key="billTypes" MethodName="GetValues"
ObjectType="{x:Type sys:Enum}">
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="local:EBillType" />
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
<local:BillTypeToBooleanConverter x:Key="billTypeToBooleanConverter" />
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="4*"/>
</Grid.RowDefinitions>
<ComboBox x:Name="cb" ItemsSource="{Binding Source={StaticResource billTypes}}" IsSynchronizedWithCurrentItem="True"/>
<DataGrid
AutoGenerateColumns="False"
ItemsSource="{Binding Bills}"
CanUserAddRows="{Binding ElementName=cb, Path=SelectedValue,
Converter={StaticResource billTypeToBooleanConverter}, Mode=OneWay}" Grid.Row="1" />
</Grid>