October 23, 2020, 07:38:17 AM

See more Support incidents in our old archived forum.

Author Topic: Adding Flexy Gantt context menus  (Read 3740 times)

ilkka.paloheimo

  • Customers
  • Newbie
  • *
  • Posts: 22
Adding Flexy Gantt context menus
« on: September 22, 2014, 08:35:19 AM »
I would like to add two context menus: "Add New Task Here" and "Edit Task".
I tried to use your demo AddTaskHereContextMenu. This demo adds "Add New Task Here" menu.
How to add an "Edit Task" menu to the demo? I can't get these two to work at same time?
Could you tell me what is the best practice to do this?

Regards, Ilkka

Rajagopal

  • RQ Members
  • Full Member
  • *
  • Posts: 149
Re: Adding Flexy Gantt context menus
« Reply #1 on: September 22, 2014, 06:29:46 PM »
 Ilkka,

Can  you tell what exactly you want to do in the "Edit Task" click? Show a dialog may be to edit the task? And what exactly is a "task" here? Is it the object that represents each bar in the chart row (if yes then you probably want to show this context menu when the user right clicks on the bar) or is it the object that represents the whole row in you data model?


Regards,
-Raja.

ilkka.paloheimo

  • Customers
  • Newbie
  • *
  • Posts: 22
Re: Adding Flexy Gantt context menus
« Reply #2 on: September 24, 2014, 10:25:08 AM »
Hello Raja,
In "Edit Task" right click (a task is here a bar in the chart row) I would like to open a context menu where the user can select what he wants to do with the selected task. And "Add New Task Here" context menu opens when the user right clicks "an empty spot" in a chart row.

Regards,
Ilkka

Rajagopal

  • RQ Members
  • Full Member
  • *
  • Posts: 149
Re: Adding Flexy Gantt context menus
« Reply #3 on: September 24, 2014, 03:16:32 PM »
Ilkka,

Take a look at "FlexyGantt\UserInteraction\CustomizingMenus" sample in our install. This sample shows how to add/remove menu items to the default menus.


Regards,
-Raja.

ilkka.paloheimo

  • Customers
  • Newbie
  • *
  • Posts: 22
Re: Adding Flexy Gantt context menus
« Reply #4 on: September 25, 2014, 08:53:25 AM »
Yes, I have added menus on "task bars" according this sample and these menus work fine. But the problem is to add "Add new task here"-right click menu on "empty" bar lines. I tried to add these as you did in the sample "FlexyGantt\UserInteraction\AddTaskHereContextMenu". But I can't get it to work with the "task bar" menus in same window.

Regards, Ilkka

Rajagopal

  • RQ Members
  • Full Member
  • *
  • Posts: 149
Re: Adding Flexy Gantt context menus
« Reply #5 on: September 26, 2014, 02:50:18 PM »
Ilkka,

Use this below code in AddTaskHereContextMenu sample,

XAML:
Code: [Select]
<fxgantt:FlexyGantt.TaskItemTemplate>
    <DataTemplate>
        <Grid Loaded="Grid_Loaded" >
         
        </Grid>
    </DataTemplate>
</fxgantt:FlexyGantt.TaskItemTemplate>

CS:
Code: [Select]
private void Grid_Loaded(object sender, RoutedEventArgs e)
{
    Grid taskbar = sender as Grid;

    taskbar.MouseRightButtonDown += new MouseButtonEventHandler(taskbar_MouseRightButtonDown);
    var menu = new ContextMenu();
    MenuItem menuitem = new MenuItem();
    menuitem.Header = "Task Context Menu";
    menuitem.Click += new RoutedEventHandler(taskMenuItem_Click); ;
    menu.Items.Add(menuitem);
    taskbar.SetValue(ContextMenuService.ContextMenuProperty, menu);
}
void taskMenuItem_Click(object sender, RoutedEventArgs e)
{
           
}

Regards,
-Raja.

ilkka.paloheimo

  • Customers
  • Newbie
  • *
  • Posts: 22
Re: Adding Flexy Gantt context menus
« Reply #6 on: September 30, 2014, 08:40:49 AM »
Raja,

Thanks alot for your help,
Ilkka