Hi, can you tell me how to remove and put resources in Scheduler using a comboboxadv
Thanks and regards
Hi Jose,
#Regarding adding or removing the resource in the SfScheduler using comboboxadv
Your requirement can be achieved by setting the comboboxadv SelectedItems values to the ResourceCollection property of the SfScheduler. Please refer to the following code snippet for your reference.
Code snippet
|
<StackPanel FlowDirection="LeftToRight" Grid.Row="0" Orientation="Horizontal"> <schedule:ComboBoxAdv Height="40" Width="120" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="4" ItemsSource="{Binding Resources}" DisplayMemberPath="Name" AllowMultiSelect="True" AllowSelectAll="True" AutoCompleteMode="Suggest" SelectedItems="{Binding SelectedResources}"> </schedule:ComboBoxAdv> <ComboBox x:Name="resourceTypeCombobox" Margin="5" Height="40" Width="120" SelectedIndex="2"/> </StackPanel> <schedule:SfScheduler x:Name="scheduler" ViewType="TimelineDay" AllowedViewTypes="Day,Week,WorkWeek,TimelineDay,TimelineMonth,TimelineWeek,TimelineWorkWeek" Grid.Row="1" ItemsSource="{Binding Appointments}" ResourceCollection="{Binding SelectedResources}" ResourceGroupType="{Binding ElementName=resourceTypeCombobox,Path=SelectedValue,Mode=TwoWay}" DisplayDate="{Binding CurrentDate}" SelectedDate="{Binding CurrentDate}" > </schedule:SfScheduler> |
In Viewmodel
|
private void InitialResources() { this.Resources = new ObservableCollection<object>(); Resources.Add(new SchedulerResource() { Name = "Naveen", Id = "0", Background = Brushes.LightCoral }); Resources.Add(new SchedulerResource() { Name = "Karthi", Id = "1", Background = Brushes.LightGreen }); Resources.Add(new SchedulerResource() { Name = "Sai", Id = "2", Background = Brushes.LightSkyBlue });
SelectedResources = new ObservableCollection<object>(Resources); } |
Please refer to the demo sample in the following locations.
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/SchedulerWPF-143363910
Please let us know if you have any concerns.
Regards,
SaiGanesh Sakthivel
Hi,
Thank you very much for your answer
Regards
Jose Maria
Hi Jose,
We are glad to know that the provided solution is resolved the query. Please let us know if you need any further assistance on this.
Regards,
SaiGanesh Sakthivel