Theming vs. HeaderTemplate (issue on Stretch)

11 posts, 0 answers
  1. Enal
    Enal avatar
    39 posts
    Member since:
    Oct 2011

    Posted 10 Oct 2011 Link to this post

    Hi - 

    I am installing a Grid containing controls as HeaderTemplate on a RadWindow, which is defined along the lines of:

    <DataTemplate x:Name="HeaderTemplate">
         <Grid x:Name="HeaderGrid" Background="Transparent" Loaded="Header_Loaded">
             <Grid.ColumnDefinitions>
                 <ColumnDefinition Width="70"/>
                 <ColumnDefinition Width="*"/>
                 <ColumnDefinition Width="30"/>
             </Grid.ColumnDefinitions>
             ...

    In a plain RadWindow this works perfectly, with the Grid being stretched and the right-most control just next to the standard window controls. However, once a Theme is getting applied the Grid does not stretch any further and all three columns are bunched up. I tried a couple of different approaches but everything leads to the same result - basically the Grid is right aligned with the center column on Auto size (just big enough to carry the content but not stretching to fill all remaining header space).

    Any help please?

    There is also a minor issue: radwin.IsHeaderHitTestVisible shows as deprecated and to be replaced with WindowHost.HitTestable. However, I don't find related documentation about usage.

    Thanks!
  2. Dani
    Admin
    Dani avatar
    848 posts

    Posted 13 Oct 2011 Link to this post

    Hello Enal,

    Thank you for pointing out this issue. Indeed, we verified such behavior in themes where change of foreground in the header is required. The issue will be fixed for the next LIB, early next week and will officially appear in the Q3 Beta release expected very soon.

    For now, you could apply a workaround by adding HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" in the Header ContentControl of RadWindow. If you are using the Metro theme, for  example:
    <ContentControl x:Name="HeaderContent" Grid.Column="1" Foreground="{StaticResource MainBrush}" FontFamily="Segoe UI Light" FontSize="16"
                                      IsHitTestVisible="{TemplateBinding IsHeaderHitTestVisible}"
                                      HorizontalAlignment="Stretch" VerticalAlignment="Center" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                      Content="{TemplateBinding Header}" ContentTemplate="{TemplateBinding HeaderTemplate}" />

    I hope this will be helpful.

    All the best,
    Dani
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  3. DevCraft banner
  4. Enal
    Enal avatar
    39 posts
    Member since:
    Oct 2011

    Posted 13 Oct 2011 Link to this post

    Thanks Dani - 

    I suppose there is no programmatic way to 'install' your workaround without modifying the theme?

    Right now my workaround is to observe SizeChanged events and apply the Width to my named header content.
    This seems to work for the moment and is less invasive for the time being.

    Thanks!

    private void TKWindow_SizeChanged(object sender, SizeChangedEventArgs e){
              var head = FindElement((FrameworkElement)sender, "HeaderGrid");
              if (head == null)
                  return;
              var width = Math.Max(0, e.NewSize.Width - 100);
              head.Width = width;
          }
  5. Dani
    Admin
    Dani avatar
    848 posts

    Posted 17 Oct 2011 Link to this post

    Hello Enal,

    No, there is no other workaround at the moment. I am glad you found your custom solution to the issue. The fix will be available from this week on, so I believe shortly you will not need the workaround anymore.

    Kind regards,
    Dani
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  6. Enal
    Enal avatar
    39 posts
    Member since:
    Oct 2011

    Posted 17 Oct 2011 Link to this post

    Ok, Dani. Thank you.
  7. Jan
    Jan avatar
    58 posts
    Member since:
    May 2010

    Posted 27 Oct 2011 Link to this post

    Hi Dani, 
    Is the fix available in Q3 beta?
  8. Dani
    Admin
    Dani avatar
    848 posts

    Posted 27 Oct 2011 Link to this post

    Hello Jan,

    Yes, this fix is available in the 2011 Q3 Beta assemblies.

    All the best,
    Dani
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  9. Jan
    Jan avatar
    58 posts
    Member since:
    May 2010

    Posted 28 Oct 2011 Link to this post

    Hello,

    Thank you a lot :)
  10. Enal
    Enal avatar
    39 posts
    Member since:
    Oct 2011

    Posted 22 Jun 2012 Link to this post

    Actually a user filed a bug and we still see a discrepancy between the Summer theme (working) and Expression Dark (not working).
    We are on 2012-1 (upgrading next week or so to 2012-2)

    Thanks!
  11. Dani
    Admin
    Dani avatar
    848 posts

    Posted 27 Jun 2012 Link to this post

    Hi Enal,

    I tested the case and the discrepancy was verified. For some reason, all themes except the Expression Dark theme were modified. I am sorry if this caused problems in your scenario. The fix will be availlable in the nearest LIB, and officially in the 2012 Q2 SP1 release.

    Greetings,
    Dani
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  12. Enal
    Enal avatar
    39 posts
    Member since:
    Oct 2011

    Posted 27 Jun 2012 Link to this post

    Thanks. Looking forward to the fix.
Back to Top
DevCraft banner