User avatar
MarioBarbero
Topic Author
Posts: 28
Joined: 10 Dec 2024, 20:04

WPF controls are pink or transparent

13 Jan 2025, 14:08

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>
Attachments
Error_Pink_Control_WPF.png
Error_Pink_Control_WPF.png (32.3 KiB) Viewed 438 times
 
User avatar
jsantos
Site Admin
Posts: 4215
Joined: 20 Jan 2012, 17:18
Contact:

Re: WPF controls are pink or transparent

13 Jan 2025, 15:04

A pink indicates that the element doesn't have a default style. What theme are you using in settings?
 
User avatar
MarioBarbero
Topic Author
Posts: 28
Joined: 10 Dec 2024, 20:04

Re: WPF controls are pink or transparent

13 Jan 2025, 15:12

We use Noesis dark blue and it doesnt need style. What do you mean?
And, why this behavior does not happen in TextBox control?
Attachments
Style_Noesis.png
 
User avatar
jsantos
Site Admin
Posts: 4215
Joined: 20 Jan 2012, 17:18
Contact:

Re: WPF controls are pink or transparent

13 Jan 2025, 16:45

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>
 
User avatar
MarioBarbero
Topic Author
Posts: 28
Joined: 10 Dec 2024, 20:04

Re: WPF controls are pink or transparent

13 Jan 2025, 16:55

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
 
User avatar
jsantos
Site Admin
Posts: 4215
Joined: 20 Jan 2012, 17:18
Contact:

Re: WPF controls are pink or transparent

14 Jan 2025, 11:23

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?
 
KeldorKatarn
Posts: 234
Joined: 30 May 2014, 10:26

Re: WPF controls are pink or transparent

17 Jan 2025, 06:08

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.
 
User avatar
jsantos
Site Admin
Posts: 4215
Joined: 20 Jan 2012, 17:18
Contact:

Re: WPF controls are pink or transparent

20 Jan 2025, 12:56

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
 
KeldorKatarn
Posts: 234
Joined: 30 May 2014, 10:26

Re: WPF controls are pink or transparent

22 Jan 2025, 00:43

Getting the .meta file for the settings messed up by not checking it into source control can be one reason
 
User avatar
jsantos
Site Admin
Posts: 4215
Joined: 20 Jan 2012, 17:18
Contact:

Re: WPF controls are pink or transparent

23 Jan 2025, 00:31

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.

Who is online

Users browsing this forum: No registered users and 6 guests