Visualstate not working as expected

Hi there,

given is a VisualStategroup like this

                                          <VisualStateManager.VisualStateGroups>

                                                           <VisualStateGroup x:Name="CommonStates">

                                                              <VisualState x:Name="Normal">

                                                                  <VisualState.Setters>

                                                                      <Setter Property="ChipTextColor" Value="{StaticResource PrimaryDarkText}" />

                                                                      <Setter Property="ChipBackground" Value="{StaticResource Tertiary}" />

                                                                  </VisualState.Setters>

                                                              </VisualState>

                                                              <VisualState x:Name="Selected">

                                                                  <VisualState.Setters>


                                                                      <Setter Property="ChipTextColor" Value="{StaticResource White}" />

                                                                      <Setter Property="ChipBackground" Value="{StaticResource Quinary}" />

                                                                  </VisualState.Setters>

                                                              </VisualState>

                                                          </VisualStateGroup>

                                         </VisualStateManager.VisualStateGroups>


By using this, the Sfchipgroup does not take this "style" before I click to one of the chips. Do I use colors instead of the static resources, everything is working as expected.


Regards


Thomas





5 Replies

AA Aarthi Arjunan Syncfusion Team July 10, 2024 12:09 PM UTC

Hi Thomas Schoessow,


Thank you for reaching out to us. We have investigated your query.


In the SfChipGroup, you can update the SelectedChip background and text color via style using the SelectedChipBackground and SelectedChipTextColor properties. We have created a sample to demonstrate how to add style for SfChipGroup background and text color in the selected state. Please refer to the attached sample and code snippets below for more details.


                <VisualState x:Name="Selected">

                    <VisualState.Setters>

                        <Setter Property="SelectedChipTextColor"    Value="{StaticResource White}" />

                        <Setter Property="SelectedChipBackground" Value="{StaticResource Gray100}" />

                        <Setter Property="ChipTextColor" Value="{StaticResource PrimaryDarkText}" />

                        <Setter Property="ChipBackground" Value="{StaticResource Tertiary}" />

                    </VisualState.Setters>

                </VisualState>


Please let us know whether the provided suggestion helps to resolve your query. Please don’t hesitate to contact us if you have any concerns or queries.


Regards,

Aarthi A.


Attachment: References_8909a6ce.zip


TS Thomas Schoessow July 11, 2024 03:44 PM UTC

Hi Aarthi Arjunan,

thanks for your reply. Sorry, to say, but I guess there is a missunderstanding. 

The point is: The above XAML is working fine as long as I use colors as a value, not a Static Resource e.g.

Setter Property="ChipTextColor" Value="black" /> works fine

while using

Setter Property="ChipTextColor" Value="{StaticResource PrimaryDarkText}" />

doesn't do anything until I clicked on any sfchip. Then all the sfchips are changing their appearance correctly.


Regards













SE Surya Elayaperumal Syncfusion Team July 12, 2024 04:21 PM UTC

Hi Thomas Schoessow

We have reviewed your query at our end. However, we are unable to reproduce the mentioned issue from our side.

To better assist you, please provide additional information about the device on which you are facing the issue and the platform. This will enable us to thoroughly investigate and propose a more accurate solution.

Please don’t hesitate to contact us if you have any further queries.


Regards,
Surya



TS Thomas Schoessow July 16, 2024 10:09 AM UTC

Hi  Surya Elayaperumal,
i have created some media to show you the issue. 

Vid1 shows the page while using static Resources for Colors. The style will be "adopted" with the first click, not while the page ist created.

staticresource.jpg shows the resources for this case.


withoutanyinteraction.jpg shows the same screen without using static resources.









Attachment: vid1_5f4234fb.zip


SE Surya Elayaperumal Syncfusion Team July 17, 2024 01:54 PM UTC

Hi Thomas Schoessow,

Thank you for your update. We have investigated your query based on your attachments.

In the SfChipGroup, you have updated the chip background and text color via style using the `ChipBackground` and `ChipTextColor` properties in the normal state. We have confirmed that these colors are applied on initial loading. The issue was not reproduced, and it works as expected. Please check the attached video for verification.

The default `ChipTextColor` is from the black family, and `PrimaryDarkText` is also a shade of black, so you might not see a noticeable difference in the colors. We suggest using a light color to clearly see the difference. We have created a sample and applied a light color to the chip text in the normal state to demonstrate this. Please check the attached sample and share your confirmation.

If the issue persists, please provide more details about the exact case, device, platform, and the package version you are using.

Please let us know whether the provided suggestion helps to resolve your query. Don’t hesitate to contact us if you have any further concerns or queries.

 

Regards,  
Surya E



Attachment: Sample_and_Video_43e83d58.zip

Loader.
Up arrow icon