Style a read-only "Slot"

11 posts, 0 answers
  1. Troy
    Troy avatar
    13 posts
    Member since:
    May 2011

    Posted 25 May 2011 Link to this post

    What is the best way to go about preventing a read-only "Slot" object from being highlighted with a mouse over?
  2. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 26 May 2011 Link to this post

    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
  3. Troy
    Troy avatar
    13 posts
    Member since:
    May 2011

    Posted 26 May 2011 Link to this post

    Even if I re-template the control there is no way to prevent that?
  4. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 26 May 2011 Link to this post

    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
  5. Troy
    Troy avatar
    13 posts
    Member since:
    May 2011

    Posted 26 May 2011 Link to this post

    Ok, thanks. I must say though, I am surprised to hear that.
  6. Sravan
    Sravan avatar
    11 posts
    Member since:
    Jul 2011

    Posted 21 Sep 2011 Link to this post

    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.
  7. Rosi
    Admin
    Rosi avatar
    2529 posts

    Posted 22 Sep 2011 Link to this post

    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 >>

  8. Sravan
    Sravan avatar
    11 posts
    Member since:
    Jul 2011

    Posted 22 Sep 2011 Link to this post

    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.
  9. Rosi
    Admin
    Rosi avatar
    2529 posts

    Posted 22 Sep 2011 Link to this post

    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 >>

  10. Sravan
    Sravan avatar
    11 posts
    Member since:
    Jul 2011

    Posted 23 Sep 2011 Link to this post

    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);
  11. Yana
    Admin
    Yana avatar
    4713 posts

    Posted 28 Sep 2011 Link to this post

    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 >>

Back to Top