Telerik gridview Problem with not being able to retrieve information bound to the cell next to the cell button when clicked

0 Answers 62 Views
Buttons GridView
son
Top achievements
Rank 1
son asked on 07 Nov 2023, 02:25 AM
hello
I am Korean, so please understand that I wrote this in translation.

[inquiry]
As the title suggests, there is a problem with my source code and it cannot be resolved.

I am coding in MVVM method.

1. Enter TEXT in “ChangeDetails” [Cell] of [Grid View]
2. When executing the event of “PgmUpCommand”
3. “ChangeDetails” does not lose focus, and the bound “ChangeDetails” value cannot be retrieved.
4. After doing number 1, click another [Cell] in the [Grid] and execute number 2 to get the “ChangeDetails” value normally.

I would appreciate it if you could tell me the solution.

Below is the source

<telerik:RadGridView x:Name="dataGrid1" Grid.Column="1" IsReadOnly="False"
ItemsSource="{Binding PgmInfoList}"
SelectedItem="{Binding SelectedPgmInfoItem, Mode=TwoWay}" Margin="239,27,-0.2,-0.4" Grid.RowSpan="2" Grid.ColumnSpan="3" >
<i:Interaction.Behaviors>
<behaviors:GridViewBehavior UseSummaryInfo="False" ShowFooterInfo="False"/>
</i:Interaction.Behaviors>
<i:Interaction.Triggers>
<i:EventTrigger EventName="Loaded">
   <prism:InvokeCommandAction Command="{Binding GroupDetailLoadedCommand}" />
</i:EventTrigger>
<i:EventTrigger EventName="CellEditEnded">
   <prism:InvokeCommandAction Command="{Binding CellEditEndedCommand}" />
</i:EventTrigger>
<i:EventTrigger EventName="SelectedCellsChanged">
   <prism:InvokeCommandAction Command="{Binding PgmInfoSelectedCellChangedCommand}"/>
</i:EventTrigger>
<i:EventTrigger EventName="RowEditEnded">
   <prism:InvokeCommandAction Command="{Binding RowEditEndedCommand}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
<telerik:RadGridView.ColumnGroups>
<telerik:GridViewColumnGroup Name="Division" Header="" />
<telerik:GridViewColumnGroup Name="Regist" Header="{Binding [WRD_RegistChangeHistory], Source={StaticResource DRes}}" />
<telerik:GridViewColumnGroup Name="Upload" Header="{Binding [WRD_UploadPGMfile], Source={StaticResource DRes}}" />
</telerik:RadGridView.ColumnGroups>
    <telerik:RadGridView.Columns>
        <telerik:GridViewDataColumn DataMemberBinding="{Binding ChangeDetails, Mode=TwoWay}" IsReadOnlyBinding="{Binding Path=IsEnableReadOnly, Mode=TwoWay}"
                                    Header="{Binding [WRD_ChangeHistory1], Source={StaticResource DRes}}"
                                HeaderCellStyle="{StaticResource GridViewHeaderRowStyleBV}"
                                ColumnGroupName="Regist"/>
        <telerik:GridViewDataColumn Header="{Binding [WRD_UP], Source={StaticResource DRes}}" ColumnGroupName="Upload" HeaderCellStyle="{StaticResource GridViewHeaderRowStyleB}">
            <telerik:GridViewDataColumn.CellTemplate>
                <DataTemplate>
                    <Button
                                Command="{Binding DataContext.PgmUpCommand,  RelativeSource={RelativeSource Mode=FindAncestor, AncestorLevel=1, AncestorType={x:Type telerik:RadGridView}}}"
                                CommandParameter="{Binding}"
                                Content="..." IsEnabled="{Binding PgmUpisEnabled}"/>
                </DataTemplate>
            </telerik:GridViewDataColumn.CellTemplate>
        </telerik:GridViewDataColumn>
    </telerik:RadGridView.Columns>
</telerik:RadGridView>


Dimitar
Telerik team
commented on 07 Nov 2023, 09:24 AM

Hi Son, 

Just the XAML is not enough for me to determine why this is not working. Would it be possible to create a small sample project with some sample data and attach it to this thread? This way I have the command implementation as well and I will be able to test this on my side. 

Thank you in advance for your patience and cooperation. I am looking forward to your reply.

No answers yet. Maybe you can help?

Tags
Buttons GridView
Asked by
son
Top achievements
Rank 1
Share this question
or