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

Custo resource selection change event?

8 Answers 39 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
ITA
Top achievements
Rank 1
ITA asked on 20 Dec 2013, 01:51 PM
Hi,

i'm using radscheduleview and appointments with custom resources:

private IEnumerable<IResource> resourcesStatus;
 
this.resourcesStatus = new List<IResource>
{
      new Resource(Klassen.Language.GetTextbyCode("Erfasst"), "Status"),
      new Resource(Klassen.Language.GetTextbyCode("Aktiv"), "Status"),
      new Resource(Klassen.Language.GetTextbyCode("Fertig"), "Status"),
};
 
ResourceType resourceTypeStatus = new ResourceType("Status");
resourceTypeStatus.Resources.AddRange(this.resourcesStatus);
 
this.resourceTypes.Add(resourceTypeStatus);

How do i add a selection change event for the resource (If i change the resourceStatus in the AppointmentDialiog, i want to do something)?

Thanks a lot
Best Regards

Merry X-MAS

8 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 21 Dec 2013, 10:59 AM
Hi Rene,

I am not sure what exactly is the required approach, however, I would suggest that you take a look at the following Code Library project which demonstrates how you could extend the EditAppointmentDialog:
http://www.telerik.com/community/code-library/wpf/scheduleview/how-to-create-advanced-custom-editapointmentdialog.aspx

Hope this will help get started with the required implementation.

Regards,
Yana
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
ITA
Top achievements
Rank 1
answered on 21 Dec 2013, 01:33 PM
Hi Yana,

i attached a snapshot of the AppointmentDialog. As you can see i have a ResourceType "Art" and i want to handle a
Event on changing from "Aufgabe" to "Bundesheer".

Thanks
Best Regards
Rene
0
Yana
Telerik team
answered on 23 Dec 2013, 12:33 PM
Hi Rene,

First, you should create a custom EditAppointmentDialog as explained in the following article:
http://www.telerik.com/help/wpf/radscheduleview-features-custom-dialogs.html. I would strongly recommend using Implicit Styles to apply a theme to the ScheduleVIew as this allow to make such customizations easier.

I will explain how the resources are handled in EditAppointmentDIalog, so you can decide what is the best approach to achieve the needed scenario - the resources are implemented in the dialog as an ItemsControl which has a RadComboBox in its ItemTemplate. The ItemsControl is bound to the ResourceTypes while the ComboBoxes to the Resources collection of the concrete ResourceType. You could search for this ItemsControl by its x:Name - "PART_Resources". It has an ItemTemplateSelector as there is a difference in the template for ResourceTypes which has AllowMultipleSelection set to "true". So the regular Template for each ResourceType is the SingleSelectionTemplate of the ResourceTypeTemplateSelector. If you've copied the EditAppointmentDialog template inside the MainWindow, you can subscribe the ComboBox inside the SingleSelectionTemplate to its SelectionChanged event.  Otherwise, you could use a CustomDialogViewModel as in the example I referred in my previous post and handle changing of the SelectedItem in it.

I hope this helps.

Regards,
Yana
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
ITA
Top achievements
Rank 1
answered on 30 Dec 2013, 08:35 AM
Hi,

I do not get on with it. The custom AppointmentDialogTemplate ist fine, but how do i display mein resources?

private IEnumerable<IResource> resourcesStatus;
 
this.resourcesStatus = new List<IResource>
{
       new Resource(Klassen.Language.GetTextbyCode("Erfasst"), "Status"),
       new Resource(Klassen.Language.GetTextbyCode("Aktiv"), "Status"),
       new Resource(Klassen.Language.GetTextbyCode("Fertig"), "Status"),
};
 
ResourceType resourceTypeStatus = new ResourceType("Status");            resourceTypeStatus.Resources.AddRange(this.resourcesStatus);
 
this.resourceTypes.Add(resourceTypeStatus);

This is just one of my resources. Now i want to display this resource in my custom AppointmentDialog!

Thanks so much
Best Regards
Rene
0
Yana
Telerik team
answered on 03 Jan 2014, 08:38 AM
Hi Rene,

I have attached a sample project with EditAppointmentDialog in order to demonstrate exactly what I meant in my previous post. Note that the DataContext of the dialog is of type AppointmentDialogViewModel and it contains all the information for the currently edited/created appointment as well as the Resources/TimeMarkers/Categories set for the ScheduleView control. You can check all the properties of the AppointmentDialogViewModel in the ShowDialog event handler as shown in the example.  These properties are used for the bindings inside the Dialog.
So, the ResourceTypes property of the AppointmentDialogViewModel is bound to the ItemsSource of an ItemsControl:
<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}"/>

and for each of the ResourceTypes there is a ComboBox in the ItemTemplate ( set inside the ItemTemplateSelector) which displays the Resources for the concrete ResourceType:
<local:ResourceTypeTemplateSelector x:Key="ResourcesEditorItemTemplateSelector">
   <local:ResourceTypeTemplateSelector.SingleSelectionTemplate>
      <DataTemplate>
         <Grid>
           <Grid.ColumnDefinitions>
              <ColumnDefinition MinWidth="100" SharedSizeGroup="LabelsGroup"/>
              <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"/>
         </Grid>
     </DataTemplate>
   <local:ResourceTypeTemplateSelector.SingleSelectionTemplate>
...

Actually this ComboBox shows the Resources for the "Status" ResourceType.

I hope this clears things up.

Regards,
Yana
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
ITA
Top achievements
Rank 1
answered on 03 Jan 2014, 02:42 PM
Hi,

thanks so much, but one more question. How to add two or three Resources?

ResourceType resourceTypeStatus = new ResourceType("Status");
ResourceType resourceTypeStatus = new ResourceType("Mitarbeiter");
ResourceType resourceTypeStatus = new ResourceType("Art");

Best Regrads and Happy new Year
Rene


0
ITA
Top achievements
Rank 1
answered on 05 Jan 2014, 04:41 PM
Hi,

problem solved, thanks a lot! But is it possible to set one of the resources invisible=true. Now i see all my three resources in my
custom appointment dialog!

Thanks
Best regards
Rene
0
Yana
Telerik team
answered on 06 Jan 2014, 09:18 AM
Hello Rene,

You could create a custom ResourceType with an additional property which then you can use in EditAppointmentDIalog and bind it to the Visibility property of the ComboBox inside SingleSelectionTemplate, here is some sample code:

public class CustomResourceType : ResourceType
{
     public Visibility IsDisplayed { get; set; }
}

CustomResourceType resourceTypeStatus = new CustomResourceType() { DisplayName="Status", IsDisplayed = Visibility.Collapsed };

and here is the binding:

<telerik:RadComboBox
   ...                
  Visibility="{Binding ResourceType.IsDisplayed}"/>

I hope this helps.

Regards,
Yana
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
ScheduleView
Asked by
ITA
Top achievements
Rank 1
Answers by
Yana
Telerik team
ITA
Top achievements
Rank 1
Share this question
or