Timebar Rendering Issue in RadWindow and TileView

2 posts, 0 answers
  1. Vijay
    Vijay avatar
    13 posts
    Member since:
    May 2012

    Posted 28 Jul 2012 Link to this post

    Hi,

    when i Place the time bar in the Rad popup window/Tile view then headers for the Timebar are not rendering.please see the screen shot and the code i used.

    in the main.xaml i am opening the timebar  as a popup using the radwindow it is not rendering Headers


    in Main.xaml
    <UserControl x:Class="TimeBarTest.MainPage"
                 xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" 
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d"
        d:DesignHeight="300" d:DesignWidth="400">


        <Grid x:Name="LayoutRoot" Background="White">
            <telerik:RadTimeBar x:Name="timebarForweekchart"  IsSnapToIntervalEnabled="True" Background="#FF5E6E65"  Height="100" VerticalAlignment="Top"
                                    
                                PeriodStart="10/1/2010"
                PeriodEnd="1/27/2012"
                SelectionStart="12/25/2011" 
                SelectionEnd="1/27/2012"
                MinSelectionRange="2.00:00:00"
                MaxSelectionRange="90.00:00:00">
                <telerik:RadTimeBar.Intervals>
                    <telerik:YearInterval  />
                    <telerik:MonthInterval />
                    <telerik:WeekInterval />
                    <telerik:DayInterval />
                </telerik:RadTimeBar.Intervals>
            </telerik:RadTimeBar>
            <Button x:Name="Popup"  Click="Popup_Click"  Content="RadPopup" Width="100" Height="100"/>
        </Grid>
    </UserControl>

    in main.xaml.cs
        private void Popup_Click(object sender, RoutedEventArgs e)
            {
                RadWindow window = new RadWindow();
                ScrollViewer scrol = new ScrollViewer();
                scrol.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
                scrol.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
                scrol.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
                scrol.Content = new Timebar();
                window.Content = scrol;
                window.Header = "Test ";
                window.Height = 500;
                window.Width = 1000;
                window.WindowStartupLocation = Telerik.Windows.Controls.WindowStartupLocation.CenterOwner;
                window.ShowDialog();
            }

    in Time bar.xaml

    <UserControl xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"  x:Class="TimeBarTest.Timebar"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d"
        d:DesignHeight="300" d:DesignWidth="400">
        <telerik:RadTimeBar x:Name="timebarForweekchart"  IsSnapToIntervalEnabled="True" Background="#FF5E6E65"  Height="100" VerticalAlignment="Top"
                                    
                                PeriodStart="10/1/2010"
                PeriodEnd="1/27/2012"
                SelectionStart="12/25/2011" 
                SelectionEnd="1/27/2012"
                MinSelectionRange="2.00:00:00"
                MaxSelectionRange="90.00:00:00">
            <telerik:RadTimeBar.Intervals>
                <telerik:YearInterval  />
                <telerik:MonthInterval />
                <telerik:WeekInterval />
                <telerik:DayInterval />
            </telerik:RadTimeBar.Intervals>
        </telerik:RadTimeBar>
    </UserControl>




    Thanks,
    RK
  2. Petar Kirov
    Admin
    Petar Kirov avatar
    425 posts

    Posted 01 Aug 2012 Link to this post

    Hi,

    The problem you are observing is that when the TimeBar doesn't have its Width/Height set to a specific value it determines it from its parent control. But in this case the parent control of the TimeBar is a ScrollViewer. When the Horizontal/VerticalScrollBarVisibility is enabled (set to Auto, Visible or Hidden) the ScrollViewer tries to calculate the Width/Height of its children, so it can set its ScrollBar(s) to the correct size. This causes an infinite layout cycle.

    I suspect that you are using a version prior to 2012 Q2 SP1, because with this version a LayoutCycleException is thrown. I tested it also with 2012 Q1 and reproduced the issue.

    My suggestion are:
    • Either set explicitly the Width and Height of your TimeBar when they are in ScrollViewer or 
    • Put the the TimeBar directly in a RadWindow (in case the built-in ScrollBar of the TimeBar is sufficient)
    • Always use the latest version of our controls - apart from new features they also contain bug fixes.

    Kind regards,
    Petar Kirov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
Back to Top