Title: GotMouseCapture via XAML
Tags: wpf;button;styles
Question: This is my ```button``` style:

```<Style x:Key="NoBorderButton" TargetType="Button"&gt;
    <Setter Property="Foreground" Value="White" /&gt;
    <Setter Property="Background" Value="Transparent" /&gt;
    <Setter Property="BorderBrush" Value="Transparent" /&gt;
    <Setter Property="BorderThickness" Value="0" /&gt;
    <Setter Property="FontSize" Value="15" /&gt;
    <Style.Triggers&gt;
        <Trigger Property="Control.IsMouseOver" Value="true"&gt;
            <Setter Property="Control.FontSize" Value="18" /&gt;
            <Setter Property="Foreground" Value="LightSkyBlue" /&gt;
        </Trigger&gt;
        <Trigger Property="Control.IsMouseOver" Value="false" &gt;
            <Setter Property="Foreground" Value="White" /&gt;
        </Trigger&gt;
    </Style.Triggers&gt;
</Style&gt;
```

i want to add another ```Trigger``` to my ```button```: ```GotMouseCapture``` and ```LostMouseCapture``` but i didn't find it, only via code behind:

```private void btnClose_LostMouseCapture(object sender, MouseEventArgs e)
{
    btnClose.Foreground = Brushes.White;
}

private void btnClose_GotMouseCapture(object sender, MouseEventArgs e)
{
    btnClose.Foreground = Brushes.DarkGray;
}
```



Here is another answer: You can use an ```EventTrigger```, here is an example:

```<EventTrigger RoutedEvent="GotMouseCapture"&gt;
    <BeginStoryboard&gt;
        <Storyboard&gt;
            <ColorAnimation Storyboard.TargetProperty="Foreground"
                            To="DarkGray"
                            Duration="0:0:0"/&gt;
        </Storyboard&gt;
     </BeginStoryboard&gt;
 </EventTrigger&gt;
```

Comment for this answer: In this way the color stay in DarkGray after lost focus and not changed back to white
Comment for this answer: I already try it but in this way it disabled my other trigger that change my Foreground when IsMouseOver
Comment for this answer: XamlParseException: Key cannot be null.\r\nParameter name: key
Comment for this answer: My code was just an example of the `IsFocused` trigger in action. Simply create another `Trigger` for when `IsFocused` is false, and set it's `Foreground` to `White`.

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2015:00:06/18/15', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<wpf><button><styles>', 'Title': 'GotMouseCapture via XAML', 'ViewCount': 279, 'id': 30918178, 'user_AboutMe': None, 'user_AccountId': 6470016.0, 'user_DisplayName': 'mark yer', 'user_Reputation': 403.0, 'user_Views': 60.0, 'user_id': 5010479.0}}