This is a migrated thread and some comments may be shown as answers.

Custom Edit Appointment Dialog with Resource

5 Answers 216 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Khaled
Top achievements
Rank 1
Khaled asked on 10 Sep 2011, 06:15 PM
Hello,

like the title says I have a custom appointment and I have resources in it, I made a custom edit appointment dialog for the extra fields I have but I don't know how to make the resources appear on the dialog?

Thanks in advance

5 Answers, 1 is accepted

Sort by
0
Rosi
Telerik team
answered on 12 Sep 2011, 06:47 AM
Hello Khaled,

Please review our online example that illustrates how to implement the task.

All the best,
Rosi
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Khaled
Top achievements
Rank 1
answered on 12 Sep 2011, 10:20 AM
Hello Rosi and thanks for the reply but the sample you provide doesn't include Resources, my question is I was unable to show the resources (Comboboxes contain values to pick from) in the form, like the "Basic Grouping" section of the sample you provide which include Category and Level as resources in it.

If I use the default appointment without customize it appear perfectly but if I modify the ControlTemplate for the Edit Appointment Dialog the resources will not appear anymore, could you please tell me how to make a custom ControlTemplate for EditAppointmentDialog that include resources?

Thanks
0
Accepted
Rosi
Telerik team
answered on 15 Sep 2011, 02:05 PM
Hi Khaled,

Yes, you are right.

We will update the example for one ofour future versions.

To have resources in the dialog you have to add the following ItemsControl in the template of the dialog:

<telerik:ItemsControl x:Name="PART_Resources" Margin="3" IsTabStop="false" BorderBrush="{x:Null}" BorderThickness="0" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" IsEnabled="{Binding IsReadOnly, Converter={StaticResource InvertedBooleanConverter}}" ItemsSource="{Binding ResourceTypes}" ItemTemplateSelector="{StaticResource ResourcesEditorItemTemplateSelector}" Visibility="{Binding ResourceTypesVisibility}" />
           
The ResourcesEditorItemTemplateSelector is added below where local namespace refer to:
xmlns:local="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.ScheduleView

<local:ResourceTypeTemplateSelector x:Key="ResourcesEditorItemTemplateSelector">
        <local:ResourceTypeTemplateSelector.SingleSelectionTemplate>
            <DataTemplate>
                <Grid>
                    <Grid.ColumnDefinitions>
                     
                        <ColumnDefinition Width="120" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <TextBlock Text="{Binding ResourceType.DisplayName}" Margin="6" />
                    <telerik:RadComboBox Grid.Column="1" Margin="3" ItemsSource="{Binding ResourceItems}" ClearSelectionButtonVisibility="Visible" ClearSelectionButtonContent="{Binding ClearAllButtonContent}" SelectedItem="{Binding SelectedItem, Mode=TwoWay}" DisplayMemberPath="Resource.DisplayName" telerik:StyleManager.Theme="{StaticResource Theme}" />
                </Grid>
            </DataTemplate>
        </local:ResourceTypeTemplateSelector.SingleSelectionTemplate>
        <local:ResourceTypeTemplateSelector.MultipleSelectionTemplate>
            <DataTemplate>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="120" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <TextBlock Text="{Binding ResourceType.DisplayName}" Margin="6" />
                    <telerik:RadComboBox Grid.Column="1" Margin="3" ItemsSource="{Binding ResourceItems}" ClearSelectionButtonVisibility="Visible" ClearSelectionButtonContent="{Binding ClearAllButtonContent}" SelectedIndex="{Binding SelectedIndex, Mode=TwoWay}" telerik:StyleManager.Theme="{StaticResource Theme}">
                        <telerik:RadComboBox.ItemContainerStyle>
                            <Style TargetType="telerik:RadComboBoxItem">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate>
                                            <CheckBox IsChecked="{Binding IsChecked, Mode=TwoWay}" Content="{Binding Resource.DisplayName}" telerik:StyleManager.Theme="{StaticResource Theme}" />
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </telerik:RadComboBox.ItemContainerStyle>
                        <telerik:RadComboBox.SelectionBoxTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding Owner.CheckedItems, Converter={StaticResource ResourcesSeparatorConverter}}" />
                            </DataTemplate>
                        </telerik:RadComboBox.SelectionBoxTemplate>
                    </telerik:RadComboBox>
                </Grid>
            </DataTemplate>
        </local:ResourceTypeTemplateSelector.MultipleSelectionTemplate>
    </local:ResourceTypeTemplateSelector>

Greetings,
Rosi
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Eric
Top achievements
Rank 1
answered on 06 Oct 2011, 03:31 PM
Are there any new known issues with this template? I have been making simple modifications to the provided template for the Edit Appointment dialog, and since updating to the latest version of the controls, the resources show the incorrect one as being selected.
When I display the appointments under their groupings, they appear associated with the correct resource, but when double-clicking the appointment to open the dialog, the selection defaults to the first item in the combobox.
It only defaults to the first resource in the list when there is already a resource of that type associated with the current appointment.

For example:
I have a resource type of Rooms
with Resources of Room 1, Room 2, Room 3.

If I create and save an appointment with a resource assigned of Room 2, when I go to edit the appointment, it has Room 1 selected in the Rooms combobox.

If I have the DayViewDefinition set to group on Rooms, the appointment appropriately shows up under the Room 2 group.

Any ideas or suggestions on where to look to solve this?
0
Rosi
Telerik team
answered on 07 Oct 2011, 10:00 AM
Hi Eric,

This is not a known issue. Please review our online example illustrating that everything works as expected at our side. I suggest you review it and find the differences at your side. If the problem still exists you can open a support thread and send us running project illustrating the issue to test it locally.

Regards,
Rosi
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
ScheduleView
Asked by
Khaled
Top achievements
Rank 1
Answers by
Rosi
Telerik team
Khaled
Top achievements
Rank 1
Eric
Top achievements
Rank 1
Share this question
or