This question is locked. New answers and comments are not allowed.
Hello, I need your help.
I have two resourcestype "Service" and "Local"
I load this resources using two queries from my screen:
I want to have two RadComboBox to show the resourcestype "Service" and "Local" and allow change the resources.
For example: If I have the resourcestype:
Service="serv1,serv2,serv3,serv4"
Local= "Loc01,Loc2,Loc03,Loc04,Loc05"
I want to have in one combobox the items : "serv1,serv2,serv3,serv4" and in the other: "Loc01,Loc2,Loc03,Loc04,Loc05"; and when I select, for example, the item serv2, I want to changed the resourceType resourceType_Local to have only the resources "Loc04,Loc05".
Can I do that?
So I created one RadComboBox, ServicosComboBox, to show the resourceType Service. My Xaml
And I tried to put all the services in one
How can I do the data binding for the RacdComboBox and how can I change the resourcetypes from my RadSheduleView when I changed the item in the combo?
Or is there a better way to do?
Thanks for your help.
I have two resourcestype "Service" and "Local"
I load this resources using two queries from my screen:
......................... ........ resourceTypes = new List<ResourceType>(); var objDataContext = (IContentItem)this.DataContext; var Screen = (Microsoft.LightSwitch.Client.IScreenObject)objDataContext.Screen; Screen.Details.Dispatcher.BeginInvoke(() => { resourceType_Service = new ResourceType("Serviço"); var serviceResources = (Screen as EditableScheduleViewApptsGrid).ServiceToAppointment.ToList(); this.resourceServiceToAppt = serviceResources; foreach (SERVICE iten in serviceResources) { Resource res = new Resource(iten.Name); resourceType_Service.Resources.Add(res); } ResourceType resourceType_Local = new ResourceType("Local"); var localResources = (Screen as EditableScheduleViewApptsGrid).LocalActiveOrder.ToList(); this.resourceLocalToAppt = localResources; foreach (LOCAL iten in localResources) { Resource res = new Resource(iten.Code + " " + iten.Name); resourceType_Local.Resources.Add(res); } resourceTypes.Add(resourceType_Service); resourceTypes.Add(resourceType_Local); }); xScheduleView.ResourceTypesSource = resourceTypes; GroupDescriptions = new GroupDescriptionCollection(); serviceGrp = new ResourceGroupDescription(); serviceGrp.ResourceType = "Serviço"; serviceGrp.ShowNullGroup = false; locationGrp = new ResourceGroupDescription(); locationGrp.ResourceType = "Local"; locationGrp.ShowNullGroup = false; GroupDescriptions.Add(serviceGrp); GroupDescriptions.Add(locationGrp); xScheduleView.GroupDescriptionsSource = GroupDescriptions; For example: If I have the resourcestype:
Service="serv1,serv2,serv3,serv4"
Local= "Loc01,Loc2,Loc03,Loc04,Loc05"
I want to have in one combobox the items : "serv1,serv2,serv3,serv4" and in the other: "Loc01,Loc2,Loc03,Loc04,Loc05"; and when I select, for example, the item serv2, I want to changed the resourceType resourceType_Local to have only the resources "Loc04,Loc05".
Can I do that?
So I created one RadComboBox, ServicosComboBox, to show the resourceType Service. My Xaml
.......... <qsf:HeaderedContentControl Grid.Column="0" Margin="2" Style="{StaticResource Header}" Header="Definições"> <StackPanel> <StackPanel> <Grid Height="30"> <Grid.ColumnDefinitions> <ColumnDefinition Width="105" /> <ColumnDefinition Width="65" /> </Grid.ColumnDefinitions> <TextBlock Text="Nº dias visiveis:" VerticalAlignment="Center" Margin="8" Grid.Column="0" /> <telerik:RadNumericUpDown Margin="0,2,2,2" Grid.Column="1" Minimum="1" Maximum="500" NumberDecimalDigits = "0" Value="{Binding ActiveViewDefinition.VisibleDays, ElementName=xScheduleView, Mode=TwoWay}" HorizontalAlignment="Right" Width="40" /> </Grid> </StackPanel> <StackPanel> <Grid > <Grid.RowDefinitions > <RowDefinition Height="*" /> <RowDefinition Height="*" /> <RowDefinition Height="*" /> <RowDefinition Height="*" /> <RowDefinition Height="*" /> </Grid.RowDefinitions> <TextBlock Text="Agrupar por:" VerticalAlignment="Center" Margin="5" Grid.Column="0" /> <CheckBox Content="Serviços" Grid.Row="1" HorizontalAlignment="Left" Margin="8" Name="chkServices" VerticalAlignment="Center" Checked="chkServices_Checked" Unchecked="chkServices_Unchecked" /> <telerik:RadComboBox x:Name="ServicosComboBox" Grid.Column="0" Grid.Row="2" Margin="8" IsEditable="True" ClearSelectionButtonVisibility="Visible" ClearSelectionButtonContent="Mostrar Todos" IsReadOnly="False" SelectedIndex="0" VerticalAlignment="Center" > </telerik:RadComboBox> </Grid> <ComboBox x:Name="ServicosCombo" Height="23" Width="120" /> </StackPanel> <telerik:RadCalendar x:Name="calendario" VerticalAlignment="Bottom" Margin="8" SelectedDate="{Binding CurrentDate, ElementName=xScheduleView, Mode=TwoWay}" SelectionMode="Single" HeaderVisibility="Visible" Foreground="{StaticResource MarkerBrush}" BorderBrush="{StaticResource AccentBrush}" Background="{StaticResource ValidationBrush}" BorderThickness="1" FontSize="9" /> </StackPanel> </qsf:HeaderedContentControl> <telerik:RadScheduleView x:Name="xScheduleView" ShowDialog="xScheduleView_ShowDialog" AppointmentSaving="xScheduleView_AppointmentSaving" AppointmentCreated="xScheduleView_AppointmentCreated" AppointmentDeleted="xScheduleView_AppointmentDeleted" AppointmentEdited="xScheduleView_AppointmentEdited" AppointmentCreating="xScheduleView_AppointmentCreating" SpecialSlotStyleSelector="{StaticResource CustomSpecialSlotStyleSelector}" Margin="2" Grid.Column="2" VerticalAlignment="Top" EditAppointmentDialogStyle="{StaticResource EditAppointmentDialogStyle}" > <telerik:RadScheduleView.ViewDefinitions> <telerik:DayViewDefinition FirstDayOfWeek="Sunday" DayStartTime="07:00" DayEndTime="20:00" MajorTickLength="30min" CalendarWeekRule="FirstFourDayWeek" VisibleDays="5" /> <telerik:WeekViewDefinition FirstDayOfWeek="Sunday" DayStartTime="07:00" DayEndTime="20:00" MajorTickLength="30min" CalendarWeekRule="FirstFourDayWeek" /> <telerik:MonthViewDefinition FirstDayOfWeek="Sunday" DayStartTime="07:00" DayEndTime="20:00" CalendarWeekRule="FirstFourDayWeek"/> <telerik:TimelineViewDefinition FirstDayOfWeek="Sunday" DayStartTime="07:00" DayEndTime="20:00" CalendarWeekRule="FirstFourDayWeek" Orientation="Vertical" /> </telerik:RadScheduleView.ViewDefinitions> </telerik:RadScheduleView> <Border Grid.Column="2" Margin="2 37 2 2" BorderBrush="#FFC8C6C6" BorderThickness="1 0 1 1" Grid.Row="1" /> </Grid> </UserControl> And I tried to put all the services in one
public IList<SERVICE> actualServiceToAppt;
to binding with the radcombobox:
public
RadScheduleViewControl()
{
InitializeComponent();
xScheduleView.Loaded +=
new RoutedEventHandler(xScheduleView_Loaded);
ServicosComboBox.Loaded +=
new RoutedEventHandler(Servicos_Loaded);
}
...........
private void Servicos_Loaded(object sender, RoutedEventArgs e) { var objDataContext = (IContentItem)this.DataContext; var Screen = (Microsoft.LightSwitch.Client.IScreenObject)objDataContext.Screen; Screen.Details.Dispatcher.BeginInvoke(delegate() { var serviceResources = (Screen as EditableScheduleViewApptsGrid).ServiceToAppointment.ToList(); this.actualServiceToAppt = serviceResources; }); }How can I do the data binding for the RacdComboBox and how can I change the resourcetypes from my RadSheduleView when I changed the item in the combo?
Or is there a better way to do?
Thanks for your help.