implementing colors in grouping in rad schedular

2 posts, 0 answers
  1. asif
    asif avatar
    12 posts
    Member since:
    Aug 2006

    Posted 14 Feb 2011 Link to this post

    I am implementing telerik's radschedular and loading resources in it with grouping functionality.
    i have multiple docotrs and i want to distingvished their data by different colors.

    Is there any mapping field for colors in ResourceMappingInfo class to map colors from resources object
    for better understanding i m attaching some part of my code over here


            For i As Integer = 0 To resourceNames.Length - 1
                Resources.Add(New PanaceaBuisnessLayer.AppointmentResource(resourceNames(i), i + 1))
                Resources(0).Color = Color.Black
       Resources(1).Color = Color.Red
            Next i

            Dim resourceMappingInfo As New ResourceMappingInfo()
            resourceMappingInfo.Id = "Id"
            resourceMappingInfo.Name = "Name"
    resourceMappingInfo.Color= ??????

            dataSource.ResourceProvider.Mapping = resourceMappingInfo
            dataSource.ResourceProvider.DataSource = Resources

            RadSchdAppView.GroupType = GroupType.Resource
            RadSchdAppView.DataSource = dataSource
  2. Dobry Zranchev
    Admin
    Dobry Zranchev avatar
    348 posts

    Posted 17 Feb 2011 Link to this post

    Hi asif,

    Thank you for writing.

    Here, it is imporant how you will represent the color in the data table - as a string or as something else. In addition, you should add custom mapping for the color property of the resource. The mapping for the color should be equal to the name of the field in the data table that represents the color. If the field in the data table has a string value, you should convert this value to color. For that purpose you should to create a converter callback functions that are set to the custom mapping object.
    ResourceMappingInfo resourceMappingInfo = new ResourceMappingInfo();
    SchedulerMapping colorMapping = new SchedulerMapping("Color", "Color");
    colorMapping.ConvertToDataSource = new ConvertCallback(this.ConvertColorToDataSource);
    colorMapping.ConvertToScheduler = new ConvertCallback(this.ConvertColorToScheduler);
     
    resourceMappingInfo.Mappings.Add(colorMapping);
     
     
    private object ConvertColorToScheduler(object obj)
    {
        //return Color as an object
        return Color.White;
    }
     
    private object ConvertColorToDataSource(object obj)
    {
        //return Color as a string
        return string.Empty;
    }

    In case that you have further question, feel free to write back.

    Greetings,
    Dobry Zranchev
    the Telerik team
    Q3’10 SP1 of RadControls for WinForms is available for download; also available is the Q1'11 Roadmap for Telerik Windows Forms controls.
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top