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

TimeBar Dates will not Bind Properly

3 Answers 115 Views
TimeBar
This is a migrated thread and some comments may be shown as answers.
Tom
Top achievements
Rank 1
Tom asked on 27 Jan 2012, 06:59 PM
I am having trouble getting values to bind to a timebar.

Here is the XAML for my test page:
<Grid x:Name="LayoutRoot">
    <Grid.RowDefinitions>
        <RowDefinition Height="*"></RowDefinition>
        <RowDefinition Height="*"></RowDefinition>
    </Grid.RowDefinitions>
    <telerik:RadTimeBar Name="timeBar1" Grid.Row="0"
            PeriodStart="{Binding PeriodStart}"
            PeriodEnd="{Binding PeriodEnd}"
            SelectionStart="{Binding SelectionStart}" 
            SelectionEnd="{Binding SelectionEnd}"
            MinSelectionRange="2.00:00:00"
            MaxSelectionRange="90.00:00:00"
            IsSnapToIntervalEnabled="False">
        <telerik:RadTimeBar.Intervals>
            <telerik:YearInterval />
            <telerik:QuarterInterval />
            <telerik:MonthInterval />
            <telerik:WeekInterval />
            <telerik:DayInterval />
            <telerik:HourInterval/>
        </telerik:RadTimeBar.Intervals>
    </telerik:RadTimeBar>
    <telerik:RadTimeBar Name="timeBar2" Grid.Row="1"
            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"
            IsSnapToIntervalEnabled="False">
        <telerik:RadTimeBar.Intervals>
            <telerik:YearInterval />
            <telerik:QuarterInterval />
            <telerik:MonthInterval />
            <telerik:WeekInterval />
            <telerik:DayInterval />
            <telerik:HourInterval/>
        </telerik:RadTimeBar.Intervals>
    </telerik:RadTimeBar>
</Grid>

timebar1 does not render properly, timebar2 does render correctly.

Here is the DataContext model:
public class testtimebarclass
    {
        public DateTime PeriodStart { get; set; }
        public DateTime PeriodEnd { get; set; }
        public DateTime SelectionStart { get; set; }
        public DateTime SelectionEnd { get; set; }
    }

Is there something obvious I am missing here?

3 Answers, 1 is accepted

Sort by
0
Tsvetie
Telerik team
answered on 01 Feb 2012, 05:26 PM
Hi Tom,

Because of the coercing mechanism of RadTimeBar, you have to use TwoWay binding, when binding the period properties. I have attached a simple test page, based on the code you provided, demonstrating the changes you need to make.

All the best,
Tsvetie
the Telerik team

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

0
Kirk
Top achievements
Rank 1
answered on 16 Feb 2012, 05:57 PM
I am doing this same thing for a project I am working on right now.

The problem I am having is that even when I two way, if the selection is changed by clicking on the time bar it breaks the binding.
0
Tsvetie
Telerik team
answered on 21 Feb 2012, 12:57 PM
Hi Kirk,

I am not quite sure I understand the problem that you describe. From the provided information, I understand that, in case you use TwoWay binding, the timebar renders correctly. And once you change the selection by clicking on the timebar, the problem occurs. I could not, however, understand what the problem is exactly. When I tested the code that I attached in my previous post, the control behaved as expected - the selection simply changed.

Could you please explain in detail the result that you get and the one that you are after. It will be best, is you send me you code as well and information on the concrete version of the controls that you use.

Kind regards,
Tsvetie
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
TimeBar
Asked by
Tom
Top achievements
Rank 1
Answers by
Tsvetie
Telerik team
Kirk
Top achievements
Rank 1
Share this question
or