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

Style a read-only "Slot"

10 Answers 141 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Troy
Top achievements
Rank 1
Troy asked on 25 May 2011, 04:00 PM
What is the best way to go about preventing a read-only "Slot" object from being highlighted with a mouse over?

10 Answers, 1 is accepted

Sort by
0
Valeri Hristov
Telerik team
answered on 26 May 2011, 10:05 AM
Hello Troy,

I am afraid you cannot prevent the mouse over effect from appearing on the read-only slots.

Best wishes,
Valeri Hristov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Troy
Top achievements
Rank 1
answered on 26 May 2011, 03:02 PM
Even if I re-template the control there is no way to prevent that?
0
Valeri Hristov
Telerik team
answered on 26 May 2011, 04:33 PM
Yes. The rectangle that represents the mouse over highlight is displayed regardless of whether you are mouse overing a regular slot or a read-only slot and this behavior has nothing to do with the control styles and templates. I will log this behavior for reviewing, we will decide whether to change the default, or allow the developers to customize it.

Kind regards,
Valeri Hristov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Troy
Top achievements
Rank 1
answered on 26 May 2011, 04:35 PM
Ok, thanks. I must say though, I am surprised to hear that.
0
Sravan
Top achievements
Rank 1
answered on 21 Sep 2011, 05:02 PM
Hi Team,

Is it possible to disable highlighting the slot when we mouse over on it.

when i mouse over on any of the slot it should not get highlighted. 

Please help me on this.


Regards,
sekhar.
0
Rosi
Telerik team
answered on 22 Sep 2011, 08:24 AM
Hi Sravan,

You can use the MouseOverHighlightStyle property of the control to change the style of the mouse over state.
For example:
<Style x:Key="MouseOverHighlightStyle" TargetType="telerik:HighlightItem">
       
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <Border Background="Transparent" >
                      
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

All the best,
Rosi
the Telerik team

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

0
Sravan
Top achievements
Rank 1
answered on 22 Sep 2011, 12:22 PM
HI Rosi,

Thanks for the reply it worked for me.

But why special slots are not rendered until we mouse over on the slot. for special slots.

i want that to be displayed as the moment as the view is loaded. at present it is happening on mouse over

Regards,
sekhar.
0
Rosi
Telerik team
answered on 22 Sep 2011, 03:52 PM
Hello Sravan,

This works as expected at our side as you can see here. I suggest you review the example and find the differences at your side. If this does not help you can send us sample running project to test it locally.

Kind regards,
Rosi
the Telerik team

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

0
Sravan
Top achievements
Rank 1
answered on 23 Sep 2011, 03:13 PM
HI Rosi 

Please find my peice of code

<local:SpecialSlotStyleSelector x:Key="SpecialSlotStyleSelector">
            <local:SpecialSlotStyleSelector.SaturdayStyle>
                <Style TargetType="telerik:HighlightItem">
                    <Setter Property="Background" Value="Silver" />
                </Style>
            </local:SpecialSlotStyleSelector.SaturdayStyle>
            <local:SpecialSlotStyleSelector.SundayStyle>
                <Style TargetType="telerik:HighlightItem">
                    <Setter Property="Background" Value="Silver" />
                    
                </Style>
            </local:SpecialSlotStyleSelector.SundayStyle>
            <local:SpecialSlotStyleSelector.WorkingHourStyle>
                <Style TargetType="telerik:HighlightItem">
                    <Setter Property="Background" Value="Transparent" />
                    <Setter Property="VerticalAlignment" Value="Top" />
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate>                                
                                    <Grid Height="25" Width="Auto" ShowGridLines="False" Background="Silver">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition></ColumnDefinition>
                                        </Grid.ColumnDefinitions>
                                        <Grid.RowDefinitions>
                                            <RowDefinition></RowDefinition>
                                        </Grid.RowDefinitions>
                                    <ProgressBar Width="Auto" Value="{Binding Effort}" Background="Black"></ProgressBar>
                                        <!--<TextBlock Margin="4 2" VerticalAlignment="Bottom" Grid.Row="0" Grid.Column="0" Text="{Binding Effort}" FontWeight="Bold" />-->
                                    </Grid>                                                            
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </local:SpecialSlotStyleSelector.WorkingHourStyle>
            <local:SpecialSlotStyleSelector.HolidayHourStyle>
                <Style TargetType="telerik:HighlightItem">
                    <Setter Property="Background" Value="Gray"></Setter>
                </Style>
            </local:SpecialSlotStyleSelector.HolidayHourStyle>
        </local:SpecialSlotStyleSelector>


my cs

public class SpecialSlotStyleSelector : ScheduleViewStyleSelector
    {
        public Style SundayStyle { get; set; }
        public Style SaturdayStyle { get; set; }
        public Style WorkingHourStyle { get; set; }
        public Style HolidayHourStyle { get; set; }


        public override Style SelectStyle(object item, DependencyObject container, ViewDefinitionBase activeViewDeifinition)
        {
            if (item is SundayOccurence)
            {
                return this.SundayStyle;
            }
            else if (item is SaturdayOccurence)
            {
                return this.SaturdayStyle;
            }
            else if (item is WorkingHourOccurence)
            {
                return this.WorkingHourStyle;
            }
            else if (item is HolidayOccurence)
            {
                return this.HolidayHourStyle;
            }
            return base.SelectStyle(item, container, activeViewDeifinition);
        }
    }


    public class HolidayOccurence : Slot
    {
        public override Slot Copy()
        {
            HolidayOccurence holiDayOcc = new HolidayOccurence();
            holiDayOcc.Start = this.Start;
            holiDayOcc.End = this.End;
            holiDayOcc.RecurrencePattern = this.RecurrencePattern.Copy();
            holiDayOcc.Resources.AddRange(this.Resources);
            return holiDayOcc;
        }
    }


    public class SundayOccurence : Slot
    {
        public override Slot Copy()
        {
            SundayOccurence sundayOcc = new SundayOccurence();
            sundayOcc.Start = this.Start;
            sundayOcc.End = this.End;
            sundayOcc.RecurrencePattern = this.RecurrencePattern.Copy();
            sundayOcc.Resources.AddRange(this.Resources);
            return sundayOcc;
        }
    }
    public class SaturdayOccurence : Slot
    {
        public override Slot Copy()
        {
            SaturdayOccurence saturdayOcc = new SaturdayOccurence();
            saturdayOcc.Start = this.Start;
            saturdayOcc.End = this.End;
            saturdayOcc.RecurrencePattern = this.RecurrencePattern.Copy();
            saturdayOcc.Resources.AddRange(this.Resources);
            return saturdayOcc;
        }
    }
    public class WorkingHourOccurence : Slot
    {
        public float Effort
        {
            get;
            set;
        }


        public override Slot Copy()
        {
            WorkingHourOccurence workingDayOcc = new WorkingHourOccurence();
            workingDayOcc.Start = this.Start;
            workingDayOcc.End = this.End;
            workingDayOcc.Effort = this.Effort;
            workingDayOcc.RecurrencePattern = this.RecurrencePattern.Copy();
            workingDayOcc.Resources.AddRange(this.Resources);
            return workingDayOcc;
        }
    

adding special slots as below


float flEffort = tempBookings.Sum(b => ((Booking)b).Effort) + rangeBookings.Sum(b => ((Booking)b).Effort);
                        double flDuration = tempBookings.Sum(b => ((Booking)b).Duration) + rangeBookings.Sum(b => ((Booking)b).Duration);
                        WorkingHourOccurence workingDayOcc = new WorkingHourOccurence();
                        workingDayOcc.Start = dtT;
                        workingDayOcc.End = dtT.AddDays(1);
                        workingDayOcc.Effort = (float)Math.Round((flEffort / flDuration) * 100, 2);
                        //workingDayOcc.RecurrencePattern = new RecurrencePattern(dtT.Day, GetRecurrenceDayOfWeekDay(dtT.DayOfWeek), RecurrenceFrequency.Daily, 1, dtT.Month, null);
                        workingDayOcc.RecurrencePattern = new RecurrencePattern(null, GetRecurrenceDayOfWeekDay(dtT.DayOfWeek), RecurrenceFrequency.Daily, 1, null, null);
                        //workingDayOcc.RecurrencePattern = new RecurrencePattern() { DayOfMonth = dtT.Day, Frequency = RecurrenceFrequency.Daily, Interval = 1, MonthOfYear = dtT.Month };
                        if (resources != null)
                            workingDayOcc.Resources.Add(trainer);
                        specialSlots.Add(workingDayOcc);
0
Yana
Telerik team
answered on 28 Sep 2011, 09:07 AM
Hi Sravan,

I've tested the provided code and wasn't able to reproduce the issue - the special slots are shown as soon as the view is loaded, please check the attached project for a reference.

If you still experience the problem, please open a support ticket and send us a simple runnable project demonstrating it there. Thanks

Greetings,
Yana
the Telerik team

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

Tags
ScheduleView
Asked by
Troy
Top achievements
Rank 1
Answers by
Valeri Hristov
Telerik team
Troy
Top achievements
Rank 1
Sravan
Top achievements
Rank 1
Rosi
Telerik team
Yana
Telerik team
Share this question
or