0
내 첫 번째 열에 xamnumericeditor가 있고 네 번째 열에 xamnumericeditor가 있습니다. 사용자가 첫 번째 열에서 xamnumericeditor를 편집 할 때 버튼을 활성화하고 싶습니다.XamDatagrid에서 필드 레이아웃 내부에 단추 사용
코드 뒤에서 처리하고 싶습니다. 또한 사용자가 셀을 편집하자마자 호출되는 "Cellupdated"메서드 호출이 있습니다.
버튼이 필드 레이아웃 안에 있습니다.
XAML 당신이 당신의 버튼에 ICommand
을 결합하면 Fieldslayout
<Style x:Key="buttonInCellStyle" TargetType="{x:Type igDP:CellValuePresenter}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}">
<Button x:Name="btnRemoveCommands" Click="Button_Click" Width="50" Background="Transparent" BorderThickness="0" BorderBrush="Transparent">
<Image Source="..\Resources\delete.png" Stretch="UniformToFill" VerticalAlignment="Center" HorizontalAlignment="Center" Height="16" Width="16"/>
<Button.Style>
<Style TargetType="{x:Type Button}">
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=DataContext.DataItem.RemoveCommandsVisibility}" Value="True">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=DataContext.DataItem.RemoveCommandsVisibility}" Value="False">
<Setter Property="Visibility" Value="Hidden"/>
</DataTrigger>
<!--<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=DataContext.DataItem.CurrentValueNullable,Mode=TwoWay}" Value="{x:Null}">
<Setter Property="Visibility" Value="Hidden"/>
</DataTrigger>-->
</Style.Triggers>
</Style>
</Button.Style>
</Button>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
private void dtgAdmin_CellUpdated(object sender, Infragistics.Windows.DataPresenter.Events.CellUpdatedEventArgs e)
{
//need to disable the button here
}
<igDP:FieldLayout>
<igDP:FieldLayout.Fields>
<igDP:Field Name="Description" Label="{LocText Key=HeaderParameter, Assembly=Sample}">
<igDP:Field.Settings>
<igDP:FieldSettings CellMinWidth="100" CellValuePresenterStyle="{StaticResource NormalCellStyle}" AllowEdit="False" />
</igDP:Field.Settings>
</igDP:Field>
<igDP:Field Name="CurrentValueNullable" Label="{LocText Key=HeaderCurrentValue, Assembly=Sample}">
<igDP:Field.Settings>
<igDP:FieldSettings EditorStyle="{StaticResource EditCellStyle}" EditorType="{x:Type igEditors:XamNumericEditor}" EditAsType="{x:Type sys:Int16}" CellMinWidth="50" />
</igDP:Field.Settings>
</igDP:Field>
<igDP:Field Name="MinValueStr" Label="{LocText Key=HeaderMinValue, Assembly=Sample}">
<igDP:Field.Settings>
<igDP:FieldSettings CellMinWidth="50" CellValuePresenterStyle="{StaticResource NormalCellStyle}" AllowEdit="False" />
</igDP:Field.Settings>
</igDP:Field>
<igDP:Field Name="MaxValueStr" Label="{LocText Key=HeaderMaxValue, Assembly=Sample}">
<igDP:Field.Settings>
<igDP:FieldSettings Width="50" CellValuePresenterStyle="{StaticResource NormalCellStyle}" AllowEdit="False" />
</igDP:Field.Settings>
</igDP:Field>
<igDP:Field Name="RemoveCommands" Label="Clear">
<igDP:Field.Settings>
<igDP:FieldSettings Width="16" CellValuePresenterStyle="{StaticResource buttonInCellStyle}" />
</igDP:Field.Settings>
</igDP:Field>
XamDataGrid가 infragistics입니까? 포럼에서이 질문을 게시하는 것을 고려 했습니까? –
예 infragistics에서 왔지만 질문을 게시했지만 어제부터 답장을 기다리고 있습니다. – hardyz009
buttonInCellStyle은 어디에 정의되어 있습니까? –