This is a migrated thread and some comments may be shown as answers.

GroupHeader and events

1 Answer 155 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Doots
Top achievements
Rank 1
Doots asked on 19 Jun 2012, 05:09 PM
Hi,

I would like to rise an event when a user click on a TextBlock located in the group header of my ScheduleView. Here is my XAML :

            <telerik:RadScheduleView.GroupHeaderContentTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding FormattedName}" Grid.Column="1" FontWeight="Bold" Width="100" HorizontalAlignment="Left" VerticalAlignment="Center">
                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="MouseUp">
                                    <commands:EventToCommand Command="{Binding TestCommand}" />
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                    </TextBlock>
                </DataTemplate>
            </telerik:RadScheduleView.GroupHeaderContentTemplate>

Nothing happen, and the TestCommand is never called in my ViewModel, could you tell me if this is possible, and if yes how to fire this event ? I tried other events than MouseUp and the result is the same.

Thanks for your help,
Doots

1 Answer, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 22 Jun 2012, 11:34 AM
Hello Doots,

There are two issues with your code:

1. First, the GroupHeader contains a button which switches to the DayViewDefinition when clicked. So in order to handle the Click event, you should remove the Command to this button. You should customize the GroupHeaderStyleSelector in order to achieve this. In the attached project I demonstrated the approach. Please check the CustomGroupHeaderTemplate template where the command to the GroupHeaderButton is removed.

2. You should handle MouseDown event ot the TextBlock as Click event is not available. Also the TestCommand should be bound like this:

<i:EventTrigger EventName="MouseDown">
    <commands:EventToCommand Command="{Binding DataContext.TestCommand,ElementName=ScheduleView}" />
</i:EventTrigger>

I've attached a simple project with the needed changes. Hope it helps.

Regards,
Yana
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
ScheduleView
Asked by
Doots
Top achievements
Rank 1
Answers by
Yana
Telerik team
Share this question
or