开发者

Why isn't my Popup within style with an included TooltipService working correctly?

I have two radio buttons I need the stylized popup to work on and adding the ToolTipService to one, fixes the Popup's functionality on both (each has its own style).

So the description. I have copy/pasted a popup we are using elsewhere in the project (also on a different type of radio button style) and put them into the styles for the buttons I am currently working on. I now can be sure the popup works where it currently is because if I add a tooltipservice to the borders defined within the style, it fixes functionality. (also if I remove the popup tags and just leave it as a grid it will show up too).

The easiest solution I can think of is to ask this. Is there a way to make a ToolTipService that is invisible/collapsed to enable the fix?

Barring that here is the code I am working with and maybe someone can answer the real issue. It has been chopped up for your viewing pleasure

<Style x:Key="VisualViewRadioButtonLeftStyle" TargetType="RadioButton" BasedOn="{StaticResource BaseLRRadioButtonStyle}">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="RadioButton">
                <Grid>
                    <VisualStateManager.VisualStateGroups>
                        <VisualStateGroup x:Name="CommonStates">
                            <VisualState x:Name="MouseOver">
                                <Storyboard>
                                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="grid">
                                        <EasingDoubleKeyFrame KeyTime="0:0:.3" Value="0"/>
                                        <EasingDoubleKeyFrame KeyTime="0:0:.5" Value="1"/>
                                        <EasingDoubleKeyFrame KeyTime="0:0:3" Value="1"/>
                                        <EasingDoubleKeyFrame KeyTime="0:0:3.4" Value="0"/>
                                    </DoubleAnimationUsingKeyFrames>
                                </Storyboard>
                            </VisualState>
                        </VisualStateGroup>
                    </VisualStateManager.VisualStateGroups>
                    <Grid>
                        <Border x:Name="Normal1" >
                            <Image Source="picture" Style="{StaticResource VisualViewRadioButtonImageStyle}" />
                        </Border>
                    </Grid>
                    <ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="1" Visibility="Collapsed" />
                    <Popup Opacity="0" IsOpen="True" IsHitTestVisible="False" >
                        <Grid x:Name="grid"  Opacity="0" IsHitTestVisible="False" >
                            <Path x:Name="path2" IsHitTestVisible="False"  Data="M1.9999998,3.9790393E-13" UseLayoutRounding="False" >
                            </Path>
                            <TextBlock Text="Chart" IsHitTestVisible="False" />
                        </Grid>
                    </Popup>
                </Grid>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

If I were to add a ToolTipService to the Border named "Normal1" it would fix both this button and the style below it (they are placed next to eachother).

I have also tried re-locating the position where I define the popup.

The two radio buttons are then added to a stackpanel to display them. The small code section is below.

<Grid>
    <StackPanel>
        <RadioButton GroupName="Tabs" x:Name="Top开发者_Python百科Content1" Style="{StaticResource VisualViewRadioButtonLeftStyle}" />
        <RadioButton GroupName="Tabs" x:Name="TopContent2List" Style="{StaticResource VisualViewRadioButtonRightStyle}" />
    </StackPanel>

    <ContentPresenter x:Name="HeaderContent" Content="{Binding MainContentTopSelected}"/>

</Grid>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜