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

Theming vs. HeaderTemplate (issue on Stretch)

10 Answers 99 Views
Window
This is a migrated thread and some comments may be shown as answers.
Enal
Top achievements
Rank 1
Enal asked on 10 Oct 2011, 02:22 PM
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!

10 Answers, 1 is accepted

Sort by
0
Dani
Telerik team
answered on 13 Oct 2011, 08:36 AM
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 >>
0
Enal
Top achievements
Rank 1
answered on 13 Oct 2011, 03:00 PM
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;
      }
0
Dani
Telerik team
answered on 17 Oct 2011, 09:00 AM
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 >>
0
Enal
Top achievements
Rank 1
answered on 17 Oct 2011, 12:58 PM
Ok, Dani. Thank you.
0
Jan
Top achievements
Rank 1
answered on 27 Oct 2011, 12:13 PM
Hi Dani, 
Is the fix available in Q3 beta?
0
Dani
Telerik team
answered on 27 Oct 2011, 04:29 PM
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 >>
0
Jan
Top achievements
Rank 1
answered on 28 Oct 2011, 09:49 AM
Hello,

Thank you a lot :)
0
Enal
Top achievements
Rank 1
answered on 22 Jun 2012, 04:08 PM
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!
0
Dani
Telerik team
answered on 27 Jun 2012, 10:55 AM
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 >>
0
Enal
Top achievements
Rank 1
answered on 27 Jun 2012, 11:34 AM
Thanks. Looking forward to the fix.
Tags
Window
Asked by
Enal
Top achievements
Rank 1
Answers by
Dani
Telerik team
Enal
Top achievements
Rank 1
Jan
Top achievements
Rank 1
Share this question
or