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

ScheduleView is scrolled horizontally after size cahnge

3 Answers 75 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Andriy
Top achievements
Rank 1
Andriy asked on 01 Sep 2020, 10:08 AM

ScheduleView is not maintaining the point where it was scrolled.

I am facing this issue in such conditions:

1) ScheduleView is scrolled on max amount horizontally.(scheduleview.jpg).

2) CustomRadDocking.DocumentHost>

Sidebar is pinned. Please note width of ScheduleView is changed automatically when sidebar is pinned. (sidebar_pin.jpg)

3) Unpin Sidebar. Now ScheduleView is not scrolled to the max amount. (scheduleview_scroll.jpg)

The layout is like this:

<custom:CustomRadDocking  RetainPaneSizeMode="DockingAndFloating"
Grid.Row="3"
Margin="0"
BorderThickness="0"
Padding="0"
controls:AnimationManager.IsAnimationEnabled="False"
controls:AnimationManager.AnimationSelector="{x:Null}"
CloseButtonPosition="InPane"
DragDropMode="Immediate">

<custom:CustomRadDocking.DocumentHost>

<telerik:RadSplitContainer>

<telerik:RadPaneGroup IsContentPreserved="True"
BorderThickness="0"
Margin="0"
Align="Justify"
AllTabsEqualHeight="True"
DocumentHostTemplate="{StaticResource DocumentHostWithoutBorders}"
Padding="0">
<telerik:RadDocumentPane Visibility="Collapsed"
CanUserClose="False"
BorderThickness="0"
Margin="0"
Padding="0"
Title="Gantt">
<telerik:RadDocumentPane.Content>
<DockPanel x:Name="Schedule_Root">
<AdornerDecorator>
<telerik:RadScheduleView x:Name="ScheduleControl"/>

</telerik:RadDocumentPane.Content>
</telerik:RadDocumentPane>
</telerik:RadPaneGroup>
</telerik:RadSplitContainer>
</custom:CustomRadDocking.DocumentHost>

<telerik:RadSplitContainer controls:DockingPanel.InitialSize="454,150"
InitialPosition="DockedRight">
<telerik:RadPaneGroup IsContentPreserved="True"
Align="Justify"
AllTabsEqualHeight="True"
Name="ExpandiblePanels">
<telerik:RadPane Header="Sidebar" />

</telerik:RadPaneGroup>
</telerik:RadSplitContainer>
</custom:CustomRadDocking>

3 Answers, 1 is accepted

Sort by
0
Dilyan Traykov
Telerik team
answered on 04 Sep 2020, 08:51 AM

Hello Andriy,

Thank you for the provided images and code snippet.

The behavior you described is expected as when the Sidebar pane is pinned, this changes the ActualWidth of the RadScheduleView control which in turn changes the Value and Maximum properties of the corresponding horizontal scrollbar.

What I can suggest in this case is to manually update the value of the scrollbar in this case by handling the SizeChanged event of the control.

        private void ScheduleControl_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            var scrollbar = ScheduleControl.ChildrenOfType<ScrollBar>().First(s => s.Name == "PART_HorizontalScrollBar");
            // set value to required value
        }
Please let me know if this would work for you.

Regards,
Dilyan Traykov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Andriy
Top achievements
Rank 1
answered on 25 Sep 2020, 11:18 AM

Hi Dilyan,

 

Thanks for your reply. I tried to implement the approach you suggested and it haven't worked. I digged up the code and found out that we have a binding to width and some other properties which in the end is affecting MinTimeRulerExtend property of ViewDefinition.

BindingOperations.SetBinding(viewDefinitionBase, ViewDefinitionBase.MinTimeRulerExtentProperty,
new MultiBinding
{
Bindings =
{
new Binding("ActualWidth") { Source = timePanel },
new Binding("VisibleDays") { Source = viewDefinitionBase },
new Binding("HoursOnScreen") { Source = this }
},
Converter = new MinTimeRulerExtentConverter()
});

public class MinTimeRulerExtentConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
var actualWidth = (double)values[0];
var visibleDays = (int) values[1];
var oneHourLength = actualWidth / 24.0;
var hoursPerScreen = 24;
if (values.Length == 3)
{
hoursPerScreen = (int) values[2];
}
return visibleDays * 24 * oneHourLength * (24 / (double)hoursPerScreen);
}

public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
return null;
}
}

If I remove this bindings and MinTimeRulerExtent is not being changed - your solution is working fine.

The reason why you solution is not working is that this binding is overriding what's being set is SizeChanged event.

Can you suggest some different approach how I can handle this issue?

0
Dinko | Tech Support Engineer
Telerik team
answered on 30 Sep 2020, 07:28 AM

Hi Andriy,

My name is Dinko, and I'm stepping in for my colleague Dilyan, who is currently out of the office.

I am thinking of a possible solution here. May I ask you to share when you set the scrollbar value in the SizeChanged event, does the Convert() method kick in? Just for the test, can you wrap the code executed in the SizeChanged event handler in Dispatcher.BeginInvoke() method? This way, you can delay the code a little bit.

private void ScheduleControl_SizeChanged(object sender, SizeChangedEventArgs e)
{
    Dispatcher.BeginInvoke((Action)(()=> { 
        var scrollbar = ScheduleControl.ChildrenOfType<ScrollBar>().First(s => s.Name == "PART_HorizontalScrollBar");
        // set value to required value
    }),System.Windows.Threading.DispatcherPriority.ApplicationIdle);
}

Regards,
Dinko
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).

Tags
ScheduleView
Asked by
Andriy
Top achievements
Rank 1
Answers by
Dilyan Traykov
Telerik team
Andriy
Top achievements
Rank 1
Dinko | Tech Support Engineer
Telerik team
Share this question
or