Exemple #1
0
        private void TaskControl_OnClick(object sender)
        {
            TaskControl control = sender as TaskControl;

            if (!control.IsSelected)
            {
                foreach (TaskControl taskControl in MainStackPanel.Children)
                {
                    taskControl.UnSelect();
                }
                _selectedTask = control.Task;
                control.Select();
            }
        }
Exemple #2
0
        private void Update()
        {
            MainStackPanel.Children.Clear();
            bool selected = false;

            foreach (EmployeeTask task in ItemsSource)
            {
                TaskControl taskControl = new TaskControl(task);
                taskControl.Margin   = new Thickness(10);
                taskControl.OnClick += TaskControl_OnClick;
                //taskControl.SetBinding(WidthProperty, "ActualWidth");
                MainStackPanel.Children.Add(taskControl);
                if (task.Equals(_selectedTask))
                {
                    taskControl.Select();
                    selected = true;
                }
            }
            if (MainStackPanel.Children.Count > 0 && !selected)
            {
                (MainStackPanel.Children[0] as TaskControl).Select();
            }
        }