Page 1 of 1

WPF controls are pink or transparent

Posted: 13 Jan 2025, 14:08
by MarioBarbero
Hello

I dont know why, but some wpf controls are pink in my views. These controls dont have style. The are no necessary.
Why and how ca i solve that?
What is the difference between PasswordBox and Textbox?

PD.: The problem is in PasswordBox control.

My code:
                    
                    <components:EmailTextBoxControl x:Name="UserNameTextBox"
                                                    InputScope="EmailSmtpAddress"
                                                    Height="112"
                                                    Width="651"
                                                    FontSize="32"
                                                    Margin="0 0 0 48"
                                                    properties:ErrorProperty.IsError="{Binding IsErrorLogin.Value}"
                                                    TextPlaceholder="{Binding LocalizationDictionary[$USER].Value}"
                                                    Text="{Binding Email.Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                                    IsValid="{Binding IsEmailValid.Value, Mode=OneWayToSource, UpdateSourceTrigger=PropertyChanged}">
                        <b:Interaction.Behaviors>
                            <behaviors:NavigationBehaviour />
                        </b:Interaction.Behaviors>
                        <b:Interaction.Triggers>
                            <b:EventTrigger EventName="LostFocus">
                                <b:InvokeCommandAction Command="{Binding LostFocusEmailCommand}"
                                                       CommandParameter="{Binding ElementName=UserNameTextBox, Path=Text}" />
                            </b:EventTrigger>
                            <b:EventTrigger EventName="TextChanged">
                                <b:InvokeCommandAction Command="{Binding EmailChangedCommand}"
                                                       CommandParameter="{Binding ElementName=UserNameTextBox, Path=Text}" />
                            </b:EventTrigger>
                        </b:Interaction.Triggers>
                    </components:EmailTextBoxControl>

                    <TextBox Text="asassasaasd" FontSize="32"/>
                    
                    <PasswordBox x:Name="UserPasswordBox"
                                 FontSize="32"
                                 Height="112"
                                 Margin="0 0 0 0"
                                 Password="fbgnbftf" Foreground="White">
                        <b:Interaction.Behaviors>
                            <behaviors:PasswordBoxRevealBehavior />
                            <behaviors:NavigationBehaviour />
                        </b:Interaction.Behaviors>
                        <b:Interaction.Triggers>
                            <b:EventTrigger EventName="PasswordChanged">
                                <b:InvokeCommandAction Command="{Binding ResetIsErrorLoginCommand}"
                                                       CommandParameter="{Binding ElementName=UserPasswordBox}" />
                            </b:EventTrigger>
                        </b:Interaction.Triggers>
                    </PasswordBox>

Re: WPF controls are pink or transparent

Posted: 13 Jan 2025, 15:04
by jsantos
A pink indicates that the element doesn't have a default style. What theme are you using in settings?

Re: WPF controls are pink or transparent

Posted: 13 Jan 2025, 15:12
by MarioBarbero
We use Noesis dark blue and it doesnt need style. What do you mean?
And, why this behavior does not happen in TextBox control?

Re: WPF controls are pink or transparent

Posted: 13 Jan 2025, 16:45
by jsantos
Our theme provides a style for the PasswordBox. Are you overriding this somewhere? Perhaps you forgot to inherit from our style using the BasedOn keyword.

Search for this in your project:
<Style TargetType="PasswordBox">
  ...
</Style>

Re: WPF controls are pink or transparent

Posted: 13 Jan 2025, 16:55
by MarioBarbero
I dont create style any for PasswordBox control because it is not necessary in my project.
Why TextBox control doesnt have this behavior? Because if you see the attached code in previous post, neither has any style

Re: WPF controls are pink or transparent

Posted: 14 Jan 2025, 11:23
by jsantos
The only explanation we have for this is that you have a style for the PasswordBox defined somewhere.

Are you able to reproduce this behavior in a clean and minimal project? If so, could you please package it and send it to us?

Re: WPF controls are pink or transparent

Posted: 17 Jan 2025, 06:08
by KeldorKatarn
I have noticed that under certain circumstances (not 100% able to reliably reproduce) Noesis in Unity can lose the connection to its settings asset. Changing the main resource dictionary sometimes does it, and then any further change has no effect. The solution is deleting the settings file and then creating a new one by using the Settings option from the menu.

That fixes it for me and then any change in Theme is recognized again. no idea exactly why this happens. Just wanted to mention that, since it fits the topic.
Maybe the reason is that the meta file gets messed up and the reference gets lost or something. Not sure how Noesis keeps track of that asset.

Re: WPF controls are pink or transparent

Posted: 20 Jan 2025, 12:56
by jsantos
I’d be happy to analyze this in more detail if you can find a way to reproduce it. I’ve tried repeatedly, but I haven’t been able to replicate the issue

Re: WPF controls are pink or transparent

Posted: 22 Jan 2025, 00:43
by KeldorKatarn
Getting the .meta file for the settings messed up by not checking it into source control can be one reason

Re: WPF controls are pink or transparent

Posted: 23 Jan 2025, 00:31
by jsantos
Getting the .meta file for the settings messed up by not checking it into source control can be one reason
That is a user-side mistake, as it changes the GUID of the asset, breaking all previous references.