Custom GanttView Column Header

4 posts, 0 answers
  1. Colin
    Colin avatar
    2 posts
    Member since:
    Oct 2012

    Posted 20 Jul 2014 Link to this post

    I'm having some trouble getting custom column headers working I wonder if anyone can help.

    The default ColumnHeaderContainer style has a TextBlock defined within its ContentTemplate which is bound to Header, I changed this to a ContentPresenter so I could display some custom content (a grid with text and icon).
    <Setter Property="ContentTemplate">
        <Setter.Value>
            <DataTemplate>
                <!--<TextBlock Text="{Binding Header}"/>-->
                <ContentPresenter Content="{Binding Header}" />
            </DataTemplate>
        </Setter.Value>
    </Setter>
    <telerik:ColumnDefinition MemberBinding="{Binding End}" Width="AutoHeaderAndContent">
        <telerik:ColumnDefinition.Header>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Column="0" Text="End"/>
                <dat:DescriptionViewer Grid.Column="1"  Description="tttttttttttttttttest"/>
            </Grid>
        </telerik:ColumnDefinition.Header>
    </telerik:ColumnDefinition>

    This works fine however I get a XamlParseException error that I can't seem to track down whenever scrolling comes into play. I've found two ways of producing this issue:
    1. Have your browser sized large enough so no scroll bars load on your GanttView, now resize your window so the scroll bars appear and it will error (usually).
    2. Have your browser sized small enough so scroll bars DO appear, sometimes loading the page with GanttView on will not cause it to error, scrolling back and fourth quickly will always trigger the error though.

    I'm currently using control version 2013.2.724.1050 from July 25 2013.

    Any help would be appreciated,
    Colin
  2. Polya
    Admin
    Polya avatar
    200 posts

    Posted 22 Jul 2014 Link to this post

    Hi Colin,

    I've created a project following the steps you described. However, I was unable to reproduce the issue.
    That's why I would ask you to please try and modify the attached project so that we can investigate the problem further.
    Also it would be very helpful if you could provide additional information about the error: stack trace or description.

    Regards,
    Polya
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. DevCraft banner
  4. Colin
    Colin avatar
    2 posts
    Member since:
    Oct 2012

    Posted 23 Jul 2014 Link to this post

    Hey Polya, thanks very much for your quick response. I altered your project slightly so the error is easier to reproduce, I altered the columns to:

    <telerik:TreeColumnDefinition MemberBinding="{Binding Title}" Header="Title" Width="120"/>
    <telerik:ColumnDefinition MemberBinding="{Binding Start}" Width="120">
        <telerik:ColumnDefinition.Header>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
     
                <TextBlock Grid.Column="0" Text="Start "/>
                <TextBlock Grid.Column="1">lalalala</TextBlock>
            </Grid>
        </telerik:ColumnDefinition.Header>
    </telerik:ColumnDefinition>
    <telerik:ColumnDefinition MemberBinding="{Binding End}" Width="120">
        <telerik:ColumnDefinition.Header>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
     
                <TextBlock Grid.Column="0" Text="End "/>
                <TextBlock Grid.Column="1">Sample text</TextBlock>
            </Grid>
        </telerik:ColumnDefinition.Header>
    </telerik:ColumnDefinition>
    <telerik:ColumnDefinition Header="Duration" MemberBinding="{Binding Duration}" Width="120" />
    <telerik:ColumnDefinition Header="Test Col." Width="AutoHeaderAndContent"/>
    <telerik:ColumnDefinition Header="Test Col." Width="AutoHeaderAndContent"/>
    <telerik:ColumnDefinition Header="Test Col." Width="AutoHeaderAndContent"/>
    <telerik:ColumnDefinition Header="Test Col." Width="AutoHeaderAndContent"/>

    This still triggers errors using my version of the controls whenever scrolling comes into play (as described in my first post make sure you trigger scroll bar visibility by making your browser smaller, then flick the scrolling on the columns back and fourth and it'll error for sure), does it error using your new version?
    I should mention we're currently looking at updating our Telerik Controls package so I should be on the new version soon, whether or not it's fixed in your newer version of the controls I'm not sure.

    Here is the stack trace:
    at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
    at MS.Internal.XcpImports.UIElement_Measure(UIElement element, Size availableSize)
    at System.Windows.UIElement.Measure(Size availableSize)
    at Telerik.Windows.Controls.GanttPresenterPanel.MeasureContainer(UIElement container, Size measureSize)
    at Telerik.Windows.Controls.GanttPresenterPanel.MeasureHeaders(Double availableWidth, ColumnDefinitionCollection columns)
    at Telerik.Windows.Controls.GanttPresenterPanel.MeasureOverride(Size availableSize)
    at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)

    Thanks for recommending Telerik Analytics, I'll be checking that out once I've got time later in the week :)
  5. Polya
    Admin
    Polya avatar
    200 posts

    Posted 25 Jul 2014 Link to this post

    Hi Colin,

    Thank you for providing the additional information and guidelines. I was able to reproduce the issue and I logged it in our Feedback portal where you can track its progress.

    Unfortunately, currently I cannot propose a solution for this problem. It appears to be Silverlight specific, as in WPF everything works fine. The only suggestion I can give is to use IsFrozenColumn = "True" to all ColumnDefinitions - this way the columns will always be visible in their full width and the ScrollBar will never appear. Hopefully such a workaround is acceptable for your scenario.

    I've updated your Telerik Points as a small token of appreciation for your efforts. Please accept the inconvenience caused.

    Regards,
    Polya
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top