RadiantQ WPF Gantt
How to find a specific task's UI element?
Previous Topic  Next Topic 

How to find a specific task's UI element?



        private void FindTaskUIButton_Click(object sender, RoutedEventArgs e)

        {

            // The top-level container of all the task rows.

            FlexyGanttChartRows chartRowsItemsControl = Extensions.GetChild<FlexyGanttChartRows>(this.fxgantt.GanttChart, false);

           

            // A specific row

            TasksListControl chartRow = chartRowsItemsControl.ItemContainerGenerator.ContainerFromIndex(4) as TasksListControl;

            // Or do this to retrieve by a bound item (employee for example) of a row.

            //TasksListControl chartRow = chartRowsItemsControl.ItemContainerGenerator.ContainerFromItem(employee) as TasksListControl;


            // The UI for a specific task

            TaskItemControl itemControl = chartRow.ItemContainerGenerator.ContainerFromIndex(0) as TaskItemControl;

            // Or do this to retrieve by the bound item (an employee's task for example).

            //TaskItemControl itemControl = chartRow.ItemContainerGenerator.ContainerFromIndex(employeeTask) as TaskItemControl;


            // Set some effect on the UI to highlight

            itemControl.Effect = new DropShadowEffect() { Color = Colors.Black, Direction = 320, ShadowDepth = 2, BlurRadius = 5, Opacity = 0.5 };

        }




� RadiantQ 2009 - 2019. All Rights Reserved.