Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
IeuanWalker authored Aug 19, 2022
1 parent 9fa8e2a commit 690972d
Showing 1 changed file with 19 additions and 22 deletions.
41 changes: 19 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,31 +43,28 @@ Install-Package IeuanWalker.StateButton
## How to style the button for different states
Simply add a Trigger to any element and bind it to the `State` property of the button -
```xaml
<stateButton:StateButton HorizontalOptions="Center">
<stateButton:StateButton.Content>
<Frame Padding="20,10" BackgroundColor="Red">
<Frame.Triggers>
<DataTrigger Binding="{Binding Source={RelativeSource AncestorType={x:Type stateButton:StateButton}}, Path=State}"
TargetType="Frame"
Value="Pressed">
<Setter Property="BackgroundColor" Value="LightGray" />
</DataTrigger>
</Frame.Triggers>
<Label Text="Test" TextColor="White">
<Label.Triggers>
<DataTrigger Binding="{Binding Source={RelativeSource AncestorType={x:Type stateButton:StateButton}}, Path=State}"
TargetType="Label"
Value="Pressed">
<Setter Property="TextColor" Value="Blue" />
</DataTrigger>
</Label.Triggers>
</Label>
</Frame>
</stateButton:StateButton.Content>
<stateButton:StateButton Padding="20,10" BackgroundColor="Red">
<stateButton:StateButton.StrokeShape>
<RoundRectangle CornerRadius="10" />
</stateButton:StateButton.StrokeShape>
<stateButton:StateButton.Triggers>
<Trigger TargetType="stateButton:StateButton" Property="State" Value="Pressed">
<Setter Property="BackgroundColor" Value="Green" />
</Trigger>
</stateButton:StateButton.Triggers>

<Label Text="Test" TextColor="White">
<Label.Triggers>
<DataTrigger Binding="{Binding Source={RelativeSource AncestorType={x:Type stateButton:StateButton}}, Path=State}"
TargetType="Label"
Value="Pressed">
<Setter Property="TextColor" Value="Blue" />
</DataTrigger>
</Label.Triggers>
</Label>
</stateButton:StateButton>
```


## Accessibility
The control itself is seen as a native button on both platforms, so inherits the same accessbility attributes. So from a screenreader and keyboard POV it is a native button.

Expand Down

0 comments on commit 690972d

Please sign in to comment.