Click event not firing on first click in a Datatemplate inside a cell-edit template

0 Answers 32 Views
AutoCompleteBox Buttons GridView Styling
swapnil
Top achievements
Rank 1
swapnil asked on 19 Mar 2024, 09:22 AM | edited on 19 Mar 2024, 09:24 AM

Hi
Please find my below code showing the celledittemplate

<telerik:GridViewDataColumn.CellEditTemplate>
    <DataTemplate>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <tbcontrols:SmartSearchRadAutoCompleteBox x:Name="JournalSuggestions" AutomationProperties.AutomationId="JournalSuggestions" 
                                        Style="{StaticResource SmartControlStyle}"  
                                        SelectionMode="Single" 
                                        KeyDown="JournalSuggestions_KeyDown"                                                                        
                                        PreviewGotKeyboardFocus="JournalSuggestions_PreviewGotKeyboardFocus"
                                        Populating="JournalSuggestions_Populating"
                                        Width="{Binding RelativeSource={RelativeSource AncestorType=telerik:GridViewDataColumn}, Path=ActualWidth}"
                                        BorderThickness="0" 
                                        BorderBrush="Transparent" 
                                        ClipToBounds="True" 
                                        AutoCompleteMode="Suggest"
                                        ItemsSource="{Binding Source={StaticResource SmartJournalAccounts}}"
                                        DisplayMemberPath="Code" 
                                        FilteringBehavior="{StaticResource LocalJournalFilter}"
                                        HorizontalAlignment="Stretch" 
                                        VerticalAlignment="Stretch"
                                        VerticalContentAlignment="Center"
                                        DropDownItemTemplate="{Binding Source={StaticResource CustomDropDownTemplate}}" 
                                        NoResultsContentTemplate="{StaticResource NoResultsContentTemplate}"
                                        DropDownWidth="Auto"  
                                        BoxesItemStyle="{StaticResource CustomRadAutoCompleteBoxesItemStyle}" 
                                        IsEnabled="True" 
                                        Margin="-17 0 0 0"                                                                        
                                        SearchText="{Binding DataContext.SmartControlSearchText, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:RadGridView}}, UpdateSourceTrigger=PropertyChanged, Mode=OneWayToSource}"
                                        SelectedItem="{Binding Path=SmartJournalAccountItem, Mode=TwoWay}"
                                        TextSearchMode="Contains" TextBoxStyle="{StaticResource TrailBalanceAccountTextBoxStyle}" FontSize="12" >
                <i:Interaction.Triggers>
                    <i:EventTrigger EventName="SelectionChanged">
                        <cal:ActionMessage MethodName="AutoCompleteBoxSelectionChanged">
                            <cal:Parameter Value="{Binding SelectedItem, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:RadAutoCompleteBox}}}"></cal:Parameter>
                        </cal:ActionMessage>
                    </i:EventTrigger>
                </i:Interaction.Triggers>
                <i:Interaction.Behaviors>
                    <behaviours:RadAutoCompleteBoxBehavior/>
                </i:Interaction.Behaviors>
            </tbcontrols:SmartSearchRadAutoCompleteBox>
            <Button x:Name="SearchButton" Grid.Column="1"
DataContext="{Binding DataContext, RelativeSource={RelativeSource AncestorType=controls:APTPanel}}"
                    Click="SearchButton_Click">                
                <Button.Visibility>
                        <con:ConverterBindableBinding Binding="{Binding IsSearchAccountVisible,UpdateSourceTrigger=PropertyChanged}" 
                                                      Converter="{StaticResource BooleanToVisibilityConverter}"
                                                      ConverterParameterBinding="{Binding IsSearchAccountVisible, RelativeSource={RelativeSource AncestorType={x:Type controls:APTPanel}}, UpdateSourceTrigger=PropertyChanged}">
                        </con:ConverterBindableBinding>
                    </Button.Visibility>
            </Button>
        </Grid>
    </DataTemplate>
</telerik:GridViewDataColumn.CellEditTemplate>

If I click the "SearchButton" on first click the event does not fire, the click event fires if I click it second time.
If I remove the SmartSearchRadAutoCompleteBox  control & only keep the SearchButton then it works ok.

Can someone give me code snippet having multiple controls (one radautosearchbox & one button) in datatemplate of celledittemplate or help me understand what is causing issue in my  Click event

Regards,
Swapnil. 

Dimitar
Telerik team
commented on 20 Mar 2024, 08:06 AM

Hi Swapnil, 

I have tested this and it seems to work on my side. I have attached my test project. Could you please check it and let me know what I am missing?

I am looking forward to your reply.

No answers yet. Maybe you can help?

Tags
AutoCompleteBox Buttons GridView Styling
Asked by
swapnil
Top achievements
Rank 1
Share this question
or