We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

how to fire button click within AgendaItemTemplate when there is ScheduleInlineCellTapped

If I use   template as below with button and i implement also  ScheduleInlineCellTapped, how can i make it that when button is tapped,  ScheduleInlineCellTapped is not fired? i tried to added InputTransparent="True"  on datagrid but i didnt help.

<schedule:SfSchedule.MonthViewSettings>
                                    <schedule:MonthViewSettings ShowAgendaView="true" >
                                        <schedule:MonthViewSettings.AgendaItemTemplate>
                                            <DataTemplate>

                            <Grid  InputTransparent="True"   HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
                                    <Grid.ColumnDefinitions>                                      
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="Auto"/>
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="*"/>
                                        <RowDefinition Height="Auto"/>                                        
                                    </Grid.RowDefinitions>
                                    <Label Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="3" Text="{Binding Subject}" HorizontalOptions="FillAndExpand"  TextColor="{Binding Color}" FontSize="Small"/>
                                    <Button BackgroundColor="Purple" Grid.Column="0" Grid.Row="1"  Text="Template" TextColor="White" />
                                  
                                </Grid>

                                            </DataTemplate>
                                        </schedule:MonthViewSettings.AgendaItemTemplate>
                                    </schedule:MonthViewSettings>



If I use image instead of buttons, template is totally corrupt. what is the problem here



6 Replies

VR Vigneshkumar Ramasamy Syncfusion Team December 12, 2018 10:09 AM UTC

Hi Emil,  
  
Thanks for contacting Syncfusion Support,  
  
Query 1: How to fire button click event in agenda view instead of SceduleInlineAppointmentTapped event  
  
We have analyzed your query “How to fire button click event in agenda view instead of SceduleInlineAppointmentTapped event” and based on the code you have shared, we found that you have set InputTransparent for grid as true, it will pass the touch to the parent, hence change this to false will be the correct solution and it works fine from our side, and it will be working only when tap on the button, if we tap any other location than button, the ScheduleInineAppointmentTapped event will be triggered as button only have the tap gestures and grid and label doesn’t have tap gesture, hence it passes the touch to it’s parent. We have modified your code and prepared a simple sample for the same, please find the sample below.  
  
Query 2: Custom view corrupt while set image  
We have already found and fixed this issue and it was included in our latest Volume 4 beta release version 16.4.0.40, please update your version and check the same, please update our latest version using the below mentioned link. If you got the error even after updating, kindly revert us back.  
  
  
Sample: Schedule  
  
We hope that this helps you, kindly revert us if you have any concern.  
  
Regards,  
Vigneshkumar R 
 



EM Emil December 12, 2018 12:14 PM UTC

HI Vigneshkumar ,

I tried with InputTransparent="False" and it still doesnt work for me. I have recognized that your test project is using pre release version of sfschedule and when i downgrade it, it also doesnt work. it means that it is fixed in the latest pre release only?

I use also other tools like sflistview, sfrating etc.

is it good idea to upgrade sfschedule on pre version and keep others in stable release. this could cause probably licencing issue as each key is tied with version number? 

thanks,

Emil


VR Vigneshkumar Ramasamy Syncfusion Team December 13, 2018 10:14 AM UTC

Hi Emil,  
  
Thanks for the update,  
  
Query 1: Regards “Setting InputTransparent = false” doesn’t work  
We have analyzed the reported issue “Setting InputTransparent = false doesn’t prevent the ScheduleInlineAppointmentTapped event” and it works fine from our side, and it doesn’t require latest version. As we mentioned in our previous update grid and label doesn’t have inbuild gesture recognizer, hence the “InputTransparent” doesn’t work for grid and label it prevents only for button to trigger the ScheduleInlineAppointmentTapped event, but you can create your own gesture recognizer and add this to the grid to prevent the ScheduleInlineAppointmentTapped event, we have prepared a simple sample for the same, please find the sample below.  
  
  <DataTemplate>  
                            <Grid x:Name="Template"  InputTransparent="False"HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">  
                                <Grid.GestureRecognizers>  
                                    <TapGestureRecognizer Tapped="Button_Clicked"NumberOfTapsRequired="1"/>  
                                </Grid.GestureRecognizers>  
                                <Grid.ColumnDefinitions>  
                                    <ColumnDefinition Width="*"/>  
                                    <ColumnDefinition Width="*"/>  
                                    <ColumnDefinition Width="*"/>  
                                </Grid.ColumnDefinitions>  
                                <Grid.RowDefinitions>  
                                    <RowDefinition Height="0.4*"/>  
                                    <RowDefinition Height="*"/>  
                                </Grid.RowDefinitions>  
                                <Label Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2"Text="{Binding Subject}" HorizontalOptions="FillAndExpand"  TextColor="{Binding Color}"FontSize="Small"/>  
                                <Button x:Name="button" Clicked="Button_Clicked"BackgroundColor="Purple" Grid.Column="0" Grid.Row="1"  Text="Template" TextColor="White" />  
                            </Grid>  
                        </DataTemplate>  
  
  
Query 2: Regards updating to the latest version  
As we have mentioned in our last update, placing image in the Agenda Item Template will works fine only with the latest version 16.4.0.40, if you have using version 16.3.0.36 the custom view doesn’t render properly on agenda view.  
  
Sample: Schedule   
  
Kindly revert us if you have any concern.  
  
Regards,  
Vigneshkumar R 



JO Jordan May 9, 2019 07:37 PM UTC

Hi there,

I'm trying to achieve the same using Prism with ViewModel command. I've tried with command behaviours but then command event isn't fired

AgendaItemTemplate:

     <schedule:MonthViewSettings.AgendaItemTemplate>
                        <DataTemplate>

                            <Grid HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
                               
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="*"/>
                                </Grid.RowDefinitions>

                                <StackLayout Grid.Column="0" Grid.Row="0">

                                    <!--<Label Text="{Binding CompanyName}" HorizontalOptions="Start" TextColor="#000000" />
                                    <Label Text="{Binding EventName}" HorizontalOptions="Start" TextColor="#000000" />-->

                                    <Button Text="{Binding EventName}" TextColor="#000000">
                                        <Button.Behaviors>
                                            <b:EventToCommandBehavior EventName="Clicked"
                                                                        Command="{Binding ViewJobCommand" CommandParameter="{Binding .}" />
                                        </Button.Behaviors>
                                    </Button>

                                </StackLayout>

                            </Grid>

                        </DataTemplate>
                    </schedule:MonthViewSettings.AgendaItemTemplate>

And Command:

private DelegateCommand<MeetingDto> _viewJobCommand;
        public DelegateCommand<MeetingDto> ViewJobCommand => _viewJobCommand ?? (_viewJobCommand = new DelegateCommand<MeetingDto>(NavigateToJob));

Would be great if you can advise on how to achieve the above!

Thanks in advance.


SP Subburaj Pandian Veluchamy Syncfusion Team May 10, 2019 01:06 PM UTC

Hi Jordan, 
  
Thank you contacting Syncfusion support. 
  
Currently, we are analyzing your query “EventToCommandBehavior doesn’t fire the event for AgendaViewTemplateItem in schedule” and we have tested the same with default list view by adding button as a template for the cell template and it doesn’t fire the event. So, we are validating the issue with framework level and we will update you further details in two business days (May 14, 2019) and appreciate your patience until then. 
 
Regards,
Subburaj Pandian V   



SP Subburaj Pandian Veluchamy Syncfusion Team May 14, 2019 06:09 AM UTC

Hi Jordan, 
  
Thank you for your patience. 
  
Based provided information, we have analyzed the reported issue “EventToCommandBehavior doesn’t fire the event for AgendaViewTemplateItem in schedule” and we found that you have bind the command to the button. You have bind the EventName to the text for button, in that case button looks in the custom appointment class for the bounded command, instead of the ViewModel in that case you can set a name for the page and bound the command to button as follows. 
  
Code Snippet 
<Button Text="{Binding EventName}" TextColor="#000000"> 
     <Button.Behaviors> 
       <behaviors:EventToCommandBehavior EventName="Clicked" 
       Command="{Binding Source={x:ReferencePage},Path=BindingContext.ViewJobCommand}"                                                                                CommandParameter="{Binding}" /> 
      </Button.Behaviors> 
</Button> 
  
We have prepared sample for the same, 
  
Sample link: Schedule 
  
We hope that this helps. Kindly revert us if you have any concern. 
 
Regards,
Subburaj Pandian V


Loader.
Up arrow icon