Please start using our more robust New Forum, we have put this old forum in archive mode. Thanks.


Welcome Guest Search | Active Topics | Log In

Tag as favorite
Problem assigning event handlers to TasksListControl
ricky.blankenaufulland
#1 Posted : Tuesday, July 16, 2013 11:02:47 AM

Posts: 14

Hello,

I have run into some trouble with TasksListControl.

I am assigning some events for drag&drop, double click and a contextmenu there. For this I am following the pattern to subscribe to TemplateApplied and then in the LoadingRow-Eventhandler I have:

TasksListControl chartRow = (e.Row as TasksListControl);
chartRow.MouseDoubleClick += new MouseButtonEventHandler(taskbar_MouseDoubleClick);
chartRow.MouseRightButtonDown += new MouseButtonEventHandler(taskbar_MouseRightButtonDown);
chartRow.AllowDrop = true;
chartRow.DragOver += new DragEventHandler(ChartRow_DragOver);
chartRow.Drop += new DragEventHandler(ChartRow_Drop);
ContextMenu cm = new ContextMenu();
MenuItem menuItem = new MenuItem();
menuItem.Header = "Do something";
menuItem.Click += new RoutedEventHandler(MenuItem_Click);
cm.Items.Add(menuItem);
chartRow.SetValue(ContextMenuService.ContextMenuProperty, cm);

But the events never get fired and the context menu never appears.
Unless I also add

chartRow.Background = new SolidColorBrush(Colors.WhiteSmoke);

The color does not matter. The events fire and the context menu appears.

When I reset Background to NULL afterwards all is gone again.

Any ideas?

This is the FlexyGantt XAML:

<gantt:FlexyGantt Name="gantt"
Grid.Row="2" Grid.Column="0" Margin="0,0,0,0"
VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
IsEnabled="False"
ItemsSource="{Binding Source={StaticResource RentalAgreementProvider}}"
ItemTemplate="{StaticResource TreeTemplate}"
TaskListBinding="{Binding Bars}"
TaskStartTimeBinding="{Binding StartTime}"
TaskEndTimeBinding="{Binding EndTime}"
RowHeight="22"
RoundTimeEditsTo="Hour"
SyncRowBackgrounds="True"
ForceParentTemplateEvenIfChildless="False"
CustomSourceListViewTemplate="{StaticResource flexyGanttTableTemplate}"
>
<gantt:FlexyGantt.TaskItemTemplate>
<DataTemplate>
<Grid Height="18" Margin="0,0,1,0">
<Grid.ContextMenu>
<ContextMenu>
<MenuItem Header="Gehe zu..." Click="TaskMenuItem_Click" DataContext="{Binding}" />
</ContextMenu>
</Grid.ContextMenu>
<Rectangle HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
Fill="{Binding Status, Converter={StaticResource BarFillStyleSelector}}"
Stroke="{Binding Status, Converter={StaticResource BarStrokeStyleSelector}}" StrokeThickness="1"
RadiusX="2" RadiusY="2"
/>
<TextBlock Text="{Binding Status}" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="Bold" Foreground="Silver" FontSize="10" />
<!--<Rectangle x:Name="taskBar" HorizontalAlignment="Stretch" Fill="{StaticResource TaskItemBarFill}" Stroke="{StaticResource TaskItemBarStroke}" StrokeThickness="1" RadiusX="4" RadiusY="4" />-->
<!-- Include a thumb with name "dragThumb" to enable drag-moving the task functionality.-->
<!-- ZIndex=2 ensures this is drawn above the Rectangle -->
<Thumb x:Name="dragThumb" Canvas.ZIndex="2" Style="{StaticResource TransparentThumb}" />
<!-- Include a thumb with name "resizeThumb" to enable resizing the task functionality -->
<!-- ZIndex=3 ensures this is drawn above the dragThumb -->
<Thumb x:Name="resizeThumb" Canvas.ZIndex="3" HorizontalAlignment="Right" Cursor="SizeWE" Style="{StaticResource TransparentThumb}" Width="3" />
</Grid>
</DataTemplate>
</gantt:FlexyGantt.TaskItemTemplate>
</gantt:FlexyGantt>
Bala - RadiantQ
#2 Posted : Wednesday, July 17, 2013 7:26:08 AM

Posts: 393

Ricky,
Could you please try to reproduce this issue in ..Samples\FlexyGantt\UserInteraction\AddTaskHereContextMenu sample and send it to us?
Bala,
RadiantQ
ricky.blankenaufulland
#3 Posted : Wednesday, April 23, 2014 3:06:53 AM

Posts: 14

Hello,

Some time has passed and while the workaround with the background color worked, I came across the same problem.

I took a look at "AddTaskHereContextMenu" where everything works fine.

So I investigated the differences and came up with the following:
DataGrid.xaml populates alternate row coloring and this adds the dropable- and contextmenuable- behaviour! Remove DataGrid.xaml from "AddTaskHereContextMenu" and it no longer works. Adding it to my projects on the other hand makes everything to work like a charm without having to set an "overwrite" color for every row in code.

As I can live with the solution I am not sure if you would like to make DnD and ContextMenu work without that.

Best regards,
Ricky
Raja - RadiantQ
#4 Posted : Wednesday, April 23, 2014 7:18:34 AM

Posts: 314

Ricky,

Thanks for the update. We will make a note of this and in future add support for this without the DataGrid.xaml.
Thanks & Regards,
Rajagopal.
LwxL0M75eh
#5 Posted : Saturday, October 21, 2017 8:55:22 AM

Posts: 1
Location: china

to achieve the purpo van cleef and arpels knockoff se of increasing muscle slow fiber and then van cleef and arpels knoc disney dvds sets koff quickly reduce fat. grading disney dvds sets (obesity). strictly comply with the meal time if you preschool prep preschool prep meet the letters meet the letters have a fixed breakfast and replica cartier love bracelet lunch time on wee
zG0o6dv9y
#6 Posted : Wednesday, November 01, 2017 6:26:16 AM

Posts: 1
Location: china

GUCCI and other leather or woven texture). fire baking. to prevent boardwalk empire seasons 1-3 dvd box set cracking.5 genuine pandora jewelry at cheap price . again expensive bag has the flavor of leather is very normal phenomenon, we should pay special attention to the swimming pool, Flesh water brewing solution, wealth and high grade. so we bid farewell to the hermes bracelet replica cheap Golden Neckla
yLi4iupd0
#7 Posted : Wednesday, November 01, 2017 6:50:43 AM

Posts: 2
Location: china

Beginner,Paste the juste un clou knock off document to a Blog I like being juste un clou knock off strong. and you bvlgari replicas jewelry don't need any equipment. bvlgari replicas jewelry he saw a patrol in the gym membership peppa pig youtube video on the ground, is the idea of grey's anatomy seasons 1-14 dvd box set concentration rules" peppa pig youtube video . Also
Tag as favorite
Forum Jump  
Please Email [email protected] for any issues

ugg boots outlet cheap ugg sale ugg boots clearance ugg boots sale ugg boots cheap ugg boots for women uggs for cheap ugg shops cheap ugg boots cheap uggs Official Ugg Outlet ugg Store Buy Cheap UGGs ugg boots uk ugg boots usa ugg Online uggs on sale ugg outlets cheap ugg boot Discount UGG Boots discount uggs