Skip to content

IsEnabled Binding converter triggers only after sorting #212

@SwiftExtender

Description

@SwiftExtender

I have Datagrid like

<DataGrid Grid.Row="1" x:Name="mgrid" ItemsSource="{Binding MacrosGridData}" Margin="10,10,10,30" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderThickness="2"  BorderBrush="Gray">
	<DataGrid.Columns>
		<DataGridTextColumn Header="Name"  Binding="{Binding Name}"/>
		<DataGridCheckBoxColumn Header="Active" Binding="{Binding IsActive}"/>
		<DataGridTextColumn Header="Checksum" Binding="{Binding Checksum}" />
		<DataGridTemplateColumn Header="Actions">
			<DataGridTemplateColumn.CellTemplate>
				<DataTemplate>
					<DockPanel>
						<Button Content="Save" IsEnabled="{Binding Name, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" Command="{Binding $parent[DataGrid].DataContext.SaveMacrosCommand}" CommandParameter="{Binding .}"/>
						<Button Content="Delete" Command="{Binding $parent[DataGrid].DataContext.RemoveMacrosCommand}" CommandParameter="{Binding .}"/>
					</DockPanel>
				</DataTemplate>
			</DataGridTemplateColumn.CellTemplate>
		</DataGridTemplateColumn>
	</DataGrid.Columns>
</DataGrid>

As you see i trying to disable button if Name is empty but after filling Name value Save button still disabled. If i sort DataGrid by any column Save button become enabled.

Before sorting

Image

After sorting

Image

I using Avalonia 11.3.12 and Avalonia.Controls.DataGrid 11.3.12

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions