Click here to Skip to main content
14,638,528 members
Home » Discussions » Silverlight / WPF
   

Silverlight / WPF

 
GeneralRe: Dividing a TextBox into columns Pin
Dwayne Barsotta7-Jan-18 3:27
MemberDwayne Barsotta7-Jan-18 3:27 
GeneralRe: Dividing a TextBox into columns Pin
Mycroft Holmes7-Jan-18 10:21
professionalMycroft Holmes7-Jan-18 10:21 
GeneralRe: Dividing a TextBox into columns Pin
Dwayne Barsotta27-Jan-18 6:24
MemberDwayne Barsotta27-Jan-18 6:24 
AnswerRe: Dividing a TextBox into columns Pin
Gerry Schmitz7-Jan-18 7:26
mveGerry Schmitz7-Jan-18 7:26 
AnswerRe: Dividing a TextBox into columns Pin
Kenneth Haugland7-Jan-18 17:41
professionalKenneth Haugland7-Jan-18 17:41 
AnswerRe: Dividing a TextBox into columns Pin
Dwayne Barsotta27-Jan-18 6:39
MemberDwayne Barsotta27-Jan-18 6:39 
GeneralRe: Dividing a TextBox into columns Pin
Gerry Schmitz27-Jan-18 12:47
mveGerry Schmitz27-Jan-18 12:47 
QuestionProblems pausing and restarting animations in XAML Pin
Kenneth Haugland6-Jan-18 0:52
professionalKenneth Haugland6-Jan-18 0:52 
As per title, I assume that is the problem.

My XAML is the following:
<Grid VerticalAlignment="Top" HorizontalAlignment="Left" Width="120" Height="30" Background="Black" x:Name="PopupParent">
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="25"/>
    </Grid.ColumnDefinitions>

    <TextBlock Grid.Column="0" x:Name="txt" Foreground="White"
               VerticalAlignment="Center" Margin="10"
               Text="Description" TextAlignment="Left">
        <TextBlock.Style>
            <Style TargetType="TextBlock">
                <Setter Property="FontWeight" Value="Normal"/>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding Mode=OneWay,ElementName=PopupChild,Path=IsOpen}" Value="True">
                        <Setter Property="FontWeight" Value="Bold"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>
        </TextBlock.Style>
    </TextBlock>
    <Path Grid.Column="1"  Width="10" Height="14" Stretch="Fill" Stroke="Black"
        Fill="{Binding ElementName=txt,Path=Foreground}"
        Data="F1 M 319.344,237.333L 287.328,218.849L 287.328,255.818L 319.344,237.333 Z "/>
    <Popup
    PlacementTarget="{Binding ElementName=PopupParent}"
    x:Name="PopupChild"
    Placement="Right"
    AllowsTransparency="True"
    PopupAnimation = "Slide">
        <Popup.Resources>
            <Storyboard x:Key="ImidiateClosePopupAnimation" TargetProperty="IsOpen" >
                <BooleanAnimationUsingKeyFrames
                              Duration="0:0:0.0">
                    <DiscreteBooleanKeyFrame Value="False" KeyTime="100%"/>
                </BooleanAnimationUsingKeyFrames>
            </Storyboard>

            <Storyboard x:Key="ClosePopupAnimation" TargetProperty="IsOpen">
                <BooleanAnimationUsingKeyFrames
                              Duration="0:0:0.05">
                    <DiscreteBooleanKeyFrame Value="False" KeyTime="100%"/>
                </BooleanAnimationUsingKeyFrames>
            </Storyboard>

            <Storyboard x:Key="OpenPopupAnimation"  Name="OpenPopupAnimation2" TargetProperty="IsOpen">
                <BooleanAnimationUsingKeyFrames Duration="0:0:0">
                    <DiscreteBooleanKeyFrame Value="True" KeyTime="100%"/>
                </BooleanAnimationUsingKeyFrames>
            </Storyboard>
        </Popup.Resources>
        <Popup.Style>
            <Style TargetType="Popup">
                <Style.Triggers>
                    <MultiDataTrigger>
                        <MultiDataTrigger.Conditions>
                            <Condition Binding="{Binding Mode=OneWay,ElementName=PopupParent,Path=IsMouseOver}" Value="False"/>
                            <Condition Binding="{Binding Mode=OneWay,ElementName=PopupChild,Path=IsMouseOver}" Value="False"/>
                        </MultiDataTrigger.Conditions>
                        <MultiDataTrigger.EnterActions>
                            <BeginStoryboard Storyboard="{StaticResource ClosePopupAnimation}"/>
                        </MultiDataTrigger.EnterActions>
                        <MultiDataTrigger.ExitActions>
                            <BeginStoryboard Name="OpenPopupAnimation2" Storyboard="{StaticResource OpenPopupAnimation}"/>
                        </MultiDataTrigger.ExitActions>
                    </MultiDataTrigger>
                    <DataTrigger Binding="{Binding Mode=OneWay,ElementName=PopupParent,Path=IsMouseOver}" Value="True">
                        <DataTrigger.EnterActions>
                            <PauseStoryboard BeginStoryboardName="closing"/>
                            <ResumeStoryboard BeginStoryboardName="OpenPopupAnimation2"/>
                        </DataTrigger.EnterActions>
                    </DataTrigger>
                    <EventTrigger RoutedEvent="MouseDown">
                        <EventTrigger.Actions>
                            <PauseStoryboard BeginStoryboardName="OpenPopupAnimation2"/>
                            <BeginStoryboard Name="closing" Storyboard="{StaticResource ImidiateClosePopupAnimation}"/>
                        </EventTrigger.Actions>
                    </EventTrigger>
                </Style.Triggers>
            </Style>
        </Popup.Style>

        <StackPanel  Width = "200" Height = "100" Background = "Black" Margin = "5">
            <TextBlock TextWrapping = "Wrap" Foreground = "White" Text = "Some information goes here"/>
            <Button Content="I'm unstyled, Click me"/>
            <Button Content="Or Click me"></Button>
        </StackPanel>
    </Popup>
</Grid>


What I'm trying to do is to have the popup appear when the mouse is over the Parent element and it will stay open as long as you are on the Parent element or its popup child. The popup closes when the mouse is no longer over any of these elements. The problem is that I want the popup to close when any of buttons on popup is pushed. As the code is now, the popup will close when the mouse is pressed on the popup, but not on the buttons. The problem is then that the animations refuse to restart and it won't show the popup when the mouse is over the parent item again. Any suggestions on what to do here?
AnswerRe: Problems pausing and restarting animations in XAML Pin
Gerry Schmitz6-Jan-18 7:48
mveGerry Schmitz6-Jan-18 7:48 
GeneralRe: Problems pausing and restarting animations in XAML Pin
Kenneth Haugland6-Jan-18 8:09
professionalKenneth Haugland6-Jan-18 8:09 
GeneralRe: Problems pausing and restarting animations in XAML Pin
Gerry Schmitz6-Jan-18 8:26
mveGerry Schmitz6-Jan-18 8:26 
GeneralRe: Problems pausing and restarting animations in XAML Pin
Kenneth Haugland6-Jan-18 8:41
professionalKenneth Haugland6-Jan-18 8:41 
GeneralRe: Problems pausing and restarting animations in XAML Pin
Gerry Schmitz6-Jan-18 8:51
mveGerry Schmitz6-Jan-18 8:51 
GeneralRe: Problems pausing and restarting animations in XAML Pin
Kenneth Haugland6-Jan-18 9:17
professionalKenneth Haugland6-Jan-18 9:17 
GeneralRe: Problems pausing and restarting animations in XAML Pin
Gerry Schmitz6-Jan-18 9:32
mveGerry Schmitz6-Jan-18 9:32 
QuestionWPF Pin
Bogadamidi3-Jan-18 16:20
MemberBogadamidi3-Jan-18 16:20 
AnswerRe: WPF Pin
Kenneth Haugland3-Jan-18 18:31
professionalKenneth Haugland3-Jan-18 18:31 
QuestionBegin a storyboard in a ControlTemplate Pin
Kenneth Haugland1-Jan-18 22:28
professionalKenneth Haugland1-Jan-18 22:28 
AnswerRe: Begin a storyboard in a ControlTemplate Pin
Pete O'Hanlon2-Jan-18 0:55
subeditorPete O'Hanlon2-Jan-18 0:55 
GeneralRe: Begin a storyboard in a ControlTemplate Pin
Kenneth Haugland2-Jan-18 3:35
professionalKenneth Haugland2-Jan-18 3:35 
GeneralRe: Begin a storyboard in a ControlTemplate Pin
Pete O'Hanlon2-Jan-18 4:38
subeditorPete O'Hanlon2-Jan-18 4:38 
AnswerRe: Begin a storyboard in a ControlTemplate Pin
Pete O'Hanlon2-Jan-18 6:11
subeditorPete O'Hanlon2-Jan-18 6:11 
GeneralRe: Begin a storyboard in a ControlTemplate Pin
Kenneth Haugland2-Jan-18 6:41
professionalKenneth Haugland2-Jan-18 6:41 
GeneralRe: Begin a storyboard in a ControlTemplate Pin
Pete O'Hanlon2-Jan-18 7:49
subeditorPete O'Hanlon2-Jan-18 7:49 
QuestionComboBoxEdit Control Pin
Kevin Marois21-Dec-17 6:09
professionalKevin Marois21-Dec-17 6:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.