Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to tell what column or cell is being edited
Message
From
25/02/2013 10:32:54
 
 
General information
Forum:
ASP.NET
Category:
Windows Presentation Foundation (WPF)
Miscellaneous
Thread ID:
01566855
Message ID:
01566859
Views:
29
>>Hi,
>>
>>I have a datagrid defined like this:
>>
>>
                        <DataGrid AutoGenerateColumns="False" Grid.Row="4" Grid.Column="1" 
>>                                  Height="Auto" 
>>                                  HorizontalAlignment="Stretch" 
>>                                  Margin="0" 
>>                                  Name="grdCashReceipts" 
>>                                  VerticalAlignment="Stretch" 
>>                                  Width="Auto" 
>>                                  IsSynchronizedWithCurrentItem="True" 
>>                                  ItemsSource="{Binding Mode=default}" 
>>                                  SelectionMode="Single" 
>>                                  GridLinesVisibility="None" 
>>                                  HeadersVisibility="Column" 
>>                                  Grid.ColumnSpan="2" 
>>                                  CellEditEnding="grdCashReceipts_CellEditEnding" 
>>                                  CanUserAddRows="False" 
>>                                  CanUserDeleteRows="False" 
>>                                  SelectionUnit="Cell" 
>>                                  Grid.RowSpan="2" 
>>                                  AlternatingRowBackground="LightGray">
>>                            <DataGrid.Resources>
>>                                <Style x:Key="AlignRight" TargetType="DataGridCell">
>>                                    <Setter Property="HorizontalAlignment" Value="Right" />
>>                                </Style>
>>                                <Style x:Key="AlignRightHeader" TargetType="DataGridColumnHeader">
>>                                    <Setter Property="HorizontalAlignment" Value="Right" />
>>                                </Style>
>>                            </DataGrid.Resources>
>>                            <DataGrid.Columns>
>>                                <DataGridTextColumn Header="Invoice #"
>>                                                    Width="*" 
>>                                                    Binding="{Binding crt_invfk, Converter={StaticResource Inv_PkToNumberConverter}}"                                                     
>>                                                    x:Name="txtInv_Number" IsReadOnly="False"/>
>>
>>                                <DataGridTextColumn Header="Invoice Date" 
>>                                                    Width="*" 
>>                                                    Binding="{Binding crt_invfk, Converter={StaticResource Inv_PkToInvoicePropertyConverter}, 
>>                                                              ConverterParameter='inv_date', Mode=OneWay, StringFormat=d}"
>>                                                    IsReadOnly="True"/>
>>                                
>>                                <DataGridTextColumn Header="Amount" 
>>                                                    Width="*" 
>>                                                    Binding="{Binding crt_Amount, Mode=default}"
>>                                                    CellStyle="{StaticResource AlignRight}"
>>                                                    HeaderStyle="{StaticResource AlignRightHeader}"/>
>>                                
>>                            </DataGrid.Columns>
>>                        </DataGrid>
>>
>>In the following method, I need to determine if I am editing the Invoice # column or txtInv_Number textbox:
>>
>>
private void grdCashReceipts_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
>>
>>How can I do that check?
>
>Haven't checked but doesn't e.Column give you that ?

e.Column.Header gives me "Invoice #", but if I then change the # to "Number" because that's what the client wants then my code breaks. I can't see anything in there that gives me "txtInv_Number"
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform