HandyOrg / HandyOrg/HandyControl

ToggleButton's Style.Triggers works only when ToggleButton's Style is set to "ToggleButtonCustom"

Open
#678 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
7.2k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

I'm trying to change the tooltip of a ToggleButton when ToggleButton is Checked/Unchecked using Style.Triggers as shown in code below.

<hc:ButtonGroup Margin="4,0,0,0" Orientation="Horizontal" Style="{StaticResource ButtonGroupSolid}" hc:BorderElement.CornerRadius="4" hc:BorderElement.Circular="True">
	<ToggleButton>
        	<Path Data="{Binding Source={StaticResource PerspectiveViewCube}, Path=Data}"  Height="15" Width="15" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="Uniform" Fill="Gray" Stroke="{DynamicResource PrimaryTextBrush}"/>
                <ToggleButton.Style>
                	<Style TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource ToggleButtonBaseStyle}">
                        	<Setter Property="ToolTip" Value="Turn ON Perspective View"/>
                                <Style.Triggers>
                                	<Trigger Property="IsChecked" Value="True">
                                            <Setter Property="ToolTip" Value="Turn OFF Perspective View"/>
                                        </Trigger>
                                </Style.Triggers>
                	</Style>
                </ToggleButton.Style>
        </ToggleButton>
</hc:ButtonGroup>

But its not working. The ToolTip is not displayed wether the ToggleButton is checked or unchecked. But if I set the style using BasedOn="{StaticResource ToggleButtonCustom}" it works. For any other Style it doesn't work.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the ToggleButton style definitions, especially ToggleButtonBaseStyle and ToggleButtonCustom, and compare how they affect the control's ToolTip and Style.Triggers. Reproduce the XAML example with checked and unchecked states; done means the tooltip changes for both states regardless of which supported base style is used.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.