Hallo,
I tried to add a ContextMenu with CommandBindings on the ActivityPresenter:
Here a code snippet:
<ControlTemplate x:Key="ActivityTemplate" TargetType="igSchedulePrim:ActivityPresenter"> <Grid> <Grid.ContextMenu> <ContextMenu> <ContextMenu.ItemsPanel> <ItemsPanelTemplate> <StackPanel Margin="-20,0,0,0" Background="White"></StackPanel> </ItemsPanelTemplate> </ContextMenu.ItemsPanel> <MenuItem Header="Status Ändern" FontSize="16" Height="40" Command="{Binding DataContext.NextDayCmd, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ig:XamScheduleView}}}" /> <MenuItem Header="Reservierung Löschen" FontSize="16" Height="40"/> </ContextMenu> </Grid.ContextMenu>
...
</Grid
</ControlTemplate>
But i get a Binding Error:
Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='Infragistics.Controls.Schedules.XamScheduleView', AncestorLevel='1''. BindingExpression:Path=DataContext.NextDayCmd; DataItem=null; target element is 'MenuItem' (Name=''); target property is 'Command' (type 'ICommand')
Hope somebody can help me.
Best regards
Dominik