ContextMenu and Resources

3 posts, 0 answers
  1. Guga
    Guga avatar
    29 posts
    Member since:
    May 2012

    Posted 17 Dec 2012 Link to this post

    Hi guys,

    I have a customized schedule view with a context menu that shows different menu options depending on where the user clicks (appointments, empty slots, resources).

    I have no problem getting the first two using the GetClickedElement<T> method. But ResourceItem doesn't derive from FrameworkElement so I can't use its type on the method.

    I am using a CustomResourceTemplate:

            <Border Height="40" Width="180" Margin="1 1 1 0" >
                <StackPanel Margin="1" Orientation="Vertical" HorizontalAlignment="Stretch">
                    <TextBlock FontFamily="Calibri" FontSize="8" FontStyle="Italic" TextAlignment="Center" Margin="1" Text="{Binding Name.DisplayName}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"  Tag="ResourceItem" />

    I tried passing the TextBlock type and I could test the Tag field, but the method always returns null.

    Any ideas?

  2. Vladi
    Vladi avatar
    749 posts

    Posted 21 Dec 2012 Link to this post


    Could you explain to us the scenario you are trying to achieve by accessing the ResourceItem with the right mouse click so we can see what is the best approach you could use?

    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. Alex
    Alex avatar
    1 posts
    Member since:
    Mar 2013

    Posted 22 May 2013 Link to this post


    I found a workaround for the right click on the resources of a scheduleview timeline... I am not doing it through the radContectMenu but I am using the OrientedGroupHeaderContentTemplateSelector and the items in the StackPanel to get to right mouseclick events. Now it will give something like a messagebox but in combination with the MouseEnter events you could also load the right resource and give it to the ContextMenu:

         <groupheader:OrientedGroupHeaderContentTemplateSelector x:Key="GroupHeaderContentTemplateSelector">
                        <Border Width="200" Padding="0 0 0 0" Margin="15 0 10 0" Height="15">
                            <StackPanel Margin="0 0 0 0">
                                <StackPanel Orientation="Horizontal" Margin="0 0 10 0" Height="15" HorizontalAlignment="Left" VerticalAlignment="Center">
                                    <Image Name="ResourcesImage" Width="10" Height="10" MouseRightButtonDown="ResourcesImage_MouseRightButtonDown_1" Tag="{Binding Name.DisplayName}"  Margin="0 0 10 0"  HorizontalAlignment="Left" VerticalAlignment="Center" Stretch="Fill" Source="{Binding Name.sIcon}" />
                                    <TextBlock Name="ResourcesText"  Height="15" Padding="0 0 0 0" MouseEnter="ResourcesText_MouseEnter_1" MouseRightButtonDown="ResourcesText_MouseRightButtonDown_1" Margin="0 0 10 0" FontSize="11" VerticalAlignment="Center" Text="{Binding Name.DisplayName}" Foreground="Black" />


Back to Top