-
Notifications
You must be signed in to change notification settings - Fork 21
WPF 886828 - Updated Selection mode topic changes #1427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Jeyasri-Murugan
merged 10 commits into
hotfix/hotfix-v26.1.35
from
Gantt_missed_changes
Jul 18, 2024
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
e188f6f
WPF 886828 - Updated Selection mode topic changes
TamilarasanGunasekaran 6eeec08
Updated review corrections
TamilarasanGunasekaran a04d2df
Review corrections updated
TamilarasanGunasekaran 4208062
Resolved CI issue
TamilarasanGunasekaran a1b0dd9
Review correction updated
TamilarasanGunasekaran 5ba2b9e
CI issue resolved
TamilarasanGunasekaran f5ad8b9
Updated the review corrections.
TamilarasanGunasekaran 308a448
None link added
TamilarasanGunasekaran 838a2c1
Update Restrict-SelectionMode-as-Single.md
Karthickmani97 2cf1598
Update Restrict-SelectionMode-as-Single.md
Karthickmani97 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,38 +1,139 @@ | ||
| --- | ||
| layout: post | ||
| title: Restrict SelectionMode as Single | Gantt | Wpf | Syncfusion | ||
| description: This section describes how to restrict the SelectionMode behavior as Single in GanttControl for WPF platform. | ||
| title: Restrict item selection | Gantt | Wpf | Syncfusion | ||
| description: This section describes how to implement the SelectionMode behavior in the Syncfusion Essential Studio WPF Gantt control. | ||
| platform: wpf | ||
| control: Gantt | ||
| documentation: ug | ||
| --- | ||
|
|
||
| # Restrict SelectionMode as Single in WPF Gantt | ||
| # Restrict item selection | ||
|
|
||
| To restrict the selection mode to single, set the ListBoxSelectionMode options of GanttGrid’s Model in the GanttControl loaded event. | ||
| To restrict item selection, set the [SelectionMode](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Gantt.GanttControl.html#Syncfusion_Windows_Controls_Gantt_GanttControl_SelectionMode) property of the [GanttControl](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Gantt.GanttControl.html) to [None](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Gantt.GanttSelectionMode.html#Syncfusion_Windows_Controls_Gantt_GanttSelectionMode_None). | ||
|
|
||
| The following codes illustrate this | ||
|
|
||
| {% tabs %} | ||
| {% highlight xaml %} | ||
| {% highlight xaml hl_lines="3" %} | ||
|
|
||
| … | ||
| <gantt:GanttControl x:Name="Gantt" | ||
| <gantt:GanttControl x:Name="gantt" | ||
| ItemsSource="{Binding TaskDetails}" | ||
| VisualStyle="Metro" | ||
| Loaded="Gantt_Loaded"> | ||
| SelectionMode="None"> | ||
| <gantt:GanttControl.DataContext> | ||
| <local:ViewModel/> | ||
| </gantt:GanttControl.DataContext> | ||
| </gantt:GanttControl> | ||
| … | ||
|
|
||
| {% endhighlight %} | ||
| {% highlight c# %} | ||
| {% highlight c# hl_lines="2" %} | ||
|
|
||
| … | ||
| private void Gantt_Loaded(object sender, RoutedEventArgs e) | ||
| { | ||
| this.Gantt.GanttGrid.Model.Options.ListBoxSelectionMode = Syncfusion.Windows.Controls.Grid.GridSelectionMode.One; | ||
| } | ||
| … | ||
| this.gantt.ItemsSource = new ViewModel().TaskCollection; | ||
| this.gantt.SelectionMode = GanttSelectionMode.None; | ||
|
|
||
| {% endhighlight %} | ||
| {% endtabs %} | ||
|
|
||
| {% highlight c# tabtitle="ViewModel.cs" %} | ||
| public class ViewModel | ||
| { | ||
| /// <summary> | ||
| /// Holds the task collections. | ||
| /// </summary> | ||
| private ObservableCollection<TaskDetails> taskCollections; | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="ViewModel"/> class. | ||
| /// </summary> | ||
| public ViewModel() | ||
| { | ||
| this.taskCollections = GetData(); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the appointment item source. | ||
| /// </summary> | ||
| /// <value>The appointment item source.</value> | ||
| public ObservableCollection<TaskDetails> TaskCollection | ||
| { | ||
| get | ||
| { | ||
| return this.taskCollections; | ||
| } | ||
| set | ||
| { | ||
| this.taskCollections = value; | ||
| } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Method to get the data. | ||
| /// </summary> | ||
| /// <returns>The task details</returns> | ||
| public ObservableCollection<TaskDetails> GetData() | ||
| { | ||
| var taskDetails = new ObservableCollection<TaskDetails>(); | ||
|
|
||
| taskDetails.Add(new TaskDetails() { TaskId = 1, TaskName = "Analysis/Planning", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 14), Progress = 40d }); | ||
| taskDetails[0].Child.Add((new TaskDetails() { TaskId = 2, TaskName = "Identify Components to be Localized", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 5), Progress = 20d })); | ||
| taskDetails[0].Child.Add((new TaskDetails() { TaskId = 3, TaskName = "Ensure file localizability", StartDate = new DateTime(2011, 7, 6), FinishDate = new DateTime(2011, 7, 7), Progress = 20d })); | ||
| taskDetails[0].Child.Add((new TaskDetails() { TaskId = 4, TaskName = "Identify tools", StartDate = new DateTime(2011, 7, 10), FinishDate = new DateTime(2011, 7, 14), Progress = 10d })); | ||
| taskDetails[0].Child.Add((new TaskDetails() { TaskId = 5, TaskName = "Test tools", StartDate = new DateTime(2011, 7, 14), FinishDate = new DateTime(2011, 8, 1), Progress = 10d })); | ||
| taskDetails[0].Child.Add((new TaskDetails() { TaskId = 6, TaskName = "Develop delivery timeline", StartDate = new DateTime(2011, 7, 10), FinishDate = new DateTime(2011, 8, 1), Progress = 10d })); | ||
| taskDetails[0].Child.Add((new TaskDetails() { TaskId = 7, TaskName = "Analysis Complete", StartDate = new DateTime(2011, 7, 14), FinishDate = new DateTime(2011, 8, 10), Progress = 10d })); | ||
|
|
||
| taskDetails.Add(new TaskDetails() { TaskId = 8, TaskName = "Production", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 14), Progress = 40d }); | ||
| taskDetails[1].Child.Add((new TaskDetails() { TaskId = 9, TaskName = "Software Components", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 5), Progress = 20d })); | ||
| taskDetails[1].Child.Add((new TaskDetails() { TaskId = 10, TaskName = "Localization Component - User Interface", StartDate = new DateTime(2011, 7, 6), FinishDate = new DateTime(2011, 7, 7), Progress = 20d })); | ||
| taskDetails[1].Child.Add((new TaskDetails() { TaskId = 11, TaskName = "User Assistance Components", StartDate = new DateTime(2011, 7, 10), FinishDate = new DateTime(2011, 7, 14), Progress = 10d })); | ||
| taskDetails[1].Child.Add((new TaskDetails() { TaskId = 12, TaskName = "Software components complete", StartDate = new DateTime(2011, 7, 14), FinishDate = new DateTime(2011, 7, 19), Progress = 10d })); | ||
|
|
||
| taskDetails.Add(new TaskDetails() { TaskId = 13, TaskName = "Quality Assurance", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 12), Progress = 40d, }); | ||
| taskDetails[2].Child.Add((new TaskDetails() { TaskId = 14, TaskName = "Review project information", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 15), Progress = 20d })); | ||
| taskDetails[2].Child.Add((new TaskDetails() { TaskId = 15, TaskName = "Localization Component", StartDate = new DateTime(2011, 7, 6), FinishDate = new DateTime(2011, 7, 8), Progress = 20d })); | ||
| taskDetails[2].Child.Add((new TaskDetails() { TaskId = 16, TaskName = "Localization Component", StartDate = new DateTime(2011, 7, 10), FinishDate = new DateTime(2011, 7, 14), Progress = 10d })); | ||
| taskDetails[2].Child.Add((new TaskDetails() { TaskId = 17, TaskName = "Localization Component", StartDate = new DateTime(2011, 7, 14), FinishDate = new DateTime(2011, 7, 18), Progress = 10d })); | ||
|
|
||
| taskDetails.Add(new TaskDetails() { TaskId = 18, TaskName = "Beta Testing", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 14), Progress = 40d }); | ||
| taskDetails[3].Child.Add((new TaskDetails() { TaskId = 19, TaskName = "Disseminate completed product", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 5), Progress = 20d })); | ||
| taskDetails[3].Child.Add((new TaskDetails() { TaskId = 20, TaskName = "Obtain feedback", StartDate = new DateTime(2011, 7, 6), FinishDate = new DateTime(2011, 7, 7), Progress = 20d })); | ||
| taskDetails[3].Child.Add((new TaskDetails() { TaskId = 21, TaskName = "Modify", StartDate = new DateTime(2011, 7, 10), FinishDate = new DateTime(2011, 7, 19), Progress = 10d })); | ||
| taskDetails[3].Child.Add((new TaskDetails() { TaskId = 22, TaskName = "Test", StartDate = new DateTime(2011, 7, 14), FinishDate = new DateTime(2011, 7, 19), Progress = 10d })); | ||
| taskDetails[3].Child.Add((new TaskDetails() { TaskId = 23, TaskName = "Complete", StartDate = new DateTime(2011, 7, 10), FinishDate = new DateTime(2011, 7, 19), Progress = 10d })); | ||
|
|
||
| taskDetails.Add(new TaskDetails() { TaskId = 24, TaskName = "Post-Project Review", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 18), Progress = 40d, }); | ||
| taskDetails[4].Child.Add((new TaskDetails() { TaskId = 25, TaskName = "Finalize cost analysis", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 5), Progress = 20d })); | ||
| taskDetails[4].Child.Add((new TaskDetails() { TaskId = 26, TaskName = "Analyze performance", StartDate = new DateTime(2011, 7, 6), FinishDate = new DateTime(2011, 7, 7), Progress = 20d })); | ||
| taskDetails[4].Child.Add((new TaskDetails() { TaskId = 27, TaskName = "Archive files", StartDate = new DateTime(2011, 7, 10), FinishDate = new DateTime(2011, 7, 14), Progress = 10d })); | ||
| taskDetails[4].Child.Add((new TaskDetails() { TaskId = 28, TaskName = "Document lessons learned", StartDate = new DateTime(2011, 7, 14), FinishDate = new DateTime(2011, 7, 18), Progress = 10d })); | ||
| taskDetails[4].Child.Add((new TaskDetails() { TaskId = 29, TaskName = "Distribute to team members", StartDate = new DateTime(2011, 7, 10), FinishDate = new DateTime(2011, 7, 14), Progress = 10d })); | ||
| taskDetails[4].Child.Add((new TaskDetails() { TaskId = 30, TaskName = "Post-project review complete", StartDate = new DateTime(2011, 7, 10), FinishDate = new DateTime(2011, 7, 14), Progress = 10d })); | ||
|
|
||
| taskDetails[0].Resources = new ObservableCollection<Resource>() { new Resource { ID = 1, Name = "John" }, new Resource { ID = 2, Name = "Neil" } }; | ||
| taskDetails[0].Child[3].Resources = new ObservableCollection<Resource>() { new Resource() { ID = 3, Name = "Peter" } }; | ||
| taskDetails[1].Resources = new ObservableCollection<Resource>() { new Resource() { ID = 4, Name = "David" } }; | ||
|
|
||
| taskDetails[0].Child[1].Predecessor.Add(new Predecessor() { GanttTaskIndex = 2, GanttTaskRelationship = GanttTaskRelationship.StartToStart }); | ||
| taskDetails[0].Child[2].Predecessor.Add(new Predecessor() { GanttTaskIndex = 3, GanttTaskRelationship = GanttTaskRelationship.StartToStart }); | ||
| taskDetails[0].Child[3].Predecessor.Add(new Predecessor() { GanttTaskIndex = 3, GanttTaskRelationship = GanttTaskRelationship.StartToStart }); | ||
|
|
||
| taskDetails[1].Child[1].Predecessor.Add(new Predecessor() { GanttTaskIndex = 9, GanttTaskRelationship = GanttTaskRelationship.StartToStart }); | ||
| taskDetails[1].Child[2].Predecessor.Add(new Predecessor() { GanttTaskIndex = 10, GanttTaskRelationship = GanttTaskRelationship.StartToStart }); | ||
| taskDetails[1].Child[3].Predecessor.Add(new Predecessor() { GanttTaskIndex = 7, GanttTaskRelationship = GanttTaskRelationship.StartToStart }); | ||
|
|
||
| taskDetails[2].Child[1].Predecessor.Add(new Predecessor() { GanttTaskIndex = 12, GanttTaskRelationship = GanttTaskRelationship.FinishToFinish }); | ||
| taskDetails[2].Child[2].Predecessor.Add(new Predecessor() { GanttTaskIndex = 12, GanttTaskRelationship = GanttTaskRelationship.FinishToFinish }); | ||
| taskDetails[2].Child[3].Predecessor.Add(new Predecessor() { GanttTaskIndex = 12, GanttTaskRelationship = GanttTaskRelationship.FinishToFinish }); | ||
|
|
||
| taskDetails[3].Child[1].Predecessor.Add(new Predecessor() { GanttTaskIndex = 18, GanttTaskRelationship = GanttTaskRelationship.StartToStart }); | ||
| taskDetails[3].Child[2].Predecessor.Add(new Predecessor() { GanttTaskIndex = 18, GanttTaskRelationship = GanttTaskRelationship.StartToStart }); | ||
| taskDetails[3].Child[3].Predecessor.Add(new Predecessor() { GanttTaskIndex = 19, GanttTaskRelationship = GanttTaskRelationship.StartToStart }); | ||
|
|
||
| taskDetails[4].Child[1].Predecessor.Add(new Predecessor() { GanttTaskIndex = 25, GanttTaskRelationship = GanttTaskRelationship.StartToStart }); | ||
| taskDetails[4].Child[2].Predecessor.Add(new Predecessor() { GanttTaskIndex = 28, GanttTaskRelationship = GanttTaskRelationship.StartToStart }); | ||
| taskDetails[4].Child[3].Predecessor.Add(new Predecessor() { GanttTaskIndex = 30, GanttTaskRelationship = GanttTaskRelationship.StartToStart }); | ||
| taskDetails[4].Child[4].Predecessor.Add(new Predecessor() { GanttTaskIndex = 27, GanttTaskRelationship = GanttTaskRelationship.StartToStart }); | ||
| return taskDetails; | ||
| } | ||
| } | ||
|
|
||
| {% endhighlight %} | ||
| {% endtabs %} | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use Code highlight for this SelectionMode
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Highlighted.