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

Problem with customize window header.

3 Answers 102 Views
Window
This is a migrated thread and some comments may be shown as answers.
Sergiy
Top achievements
Rank 1
Sergiy asked on 14 Sep 2012, 08:19 AM
Hi, I try to customize Window Header and add some  textblock (see atach).

<t:RadWindow.HeaderTemplate>
    <DataTemplate>
        <Grid Margin="10,0">
            <ContentPresenter Content="{Binding}" HorizontalAlignment="Left"/>
            <TextBlock x:Name="txtblk" Text="XAML" Opacity="0.4" FontSize="16" HorizontalAlignment="Right">
                <TextBlock.Triggers>
                    <EventTrigger RoutedEvent="TextBlock.MouseEnter">
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation
                                    Storyboard.TargetName="txtblk"
                                    Storyboard.TargetProperty="(TextBlock.Opacity)"
                                    From="0.4" To="1" Duration="0:0:0.5"/>
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger>
                </TextBlock.Triggers>
            </TextBlock>
        </Grid>
    </DataTemplate>
</t:RadWindow.HeaderTemplate>

But it works when TextBlock FontSize is 20 or more for instance. When I set FontSize to 16, triggers or doubleanimation don't work.
Why?
How to solve this problem?
Thanks.

3 Answers, 1 is accepted

Sort by
0
Accepted
Georgi
Telerik team
answered on 18 Sep 2012, 11:36 AM
Hi Sergiy,

There is a part of the RadWindows header which does not register events like MouseEnter, but setting the Font to 20 overcomes that area and therefore the animation is working. So all you need to do is set the WindowHost.HitTestable attached property to true:

<DataTemplate>
            <Grid Margin="10,0">
                <ContentPresenter Content="{Binding}" HorizontalAlignment="Left"/>
                <TextBlock x:Name="txtblk" Text="XAML" Opacity="0.4" FontSize="16" HorizontalAlignment="Right" telerik:WindowHost.HitTestable="True">     
.......................................................

It would be great if you can give it a try and let us know if it works for you.

Regards,
Georgi
the Telerik team

Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

0
Sergiy
Top achievements
Rank 1
answered on 19 Sep 2012, 07:11 AM
Thanks, it`s works, but I already using simple button with custom style.
Could you explain how it works? (telerik:WindowHost.HitTestable="True")
0
Georgi
Telerik team
answered on 21 Sep 2012, 10:49 AM
Hello Sergiy,

In the described scenario the events are handled by the Windows, not by the WPF. But when the HitTestVisible is set to true the event is send to WPF instead - it finds the element that the property is set to and executes the corresponding logic.

Kind regards,
Georgi
the Telerik team

Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

Tags
Window
Asked by
Sergiy
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Sergiy
Top achievements
Rank 1
Share this question
or