-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot find resource named 'MaterialDesignCharacterCounterTextBlock'. #3613
Comments
The style has been put inside the style @nicolaihenriksen can maybe answer this question better. @jamesport079 for this moment, I'd write my own style with following content: <Style x:Key="MaterialDesignCharacterCounterTextBlock"
TargetType="TextBlock"
BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="FontSize" Value="10" />
<Setter Property="Opacity" Value="0.56" />
<Setter Property="Text">
<Setter.Value>
<MultiBinding StringFormat="{}{0} / {1}">
<Binding Converter="{StaticResource StringLengthValueConverter}"
Path="Text"
RelativeSource="{RelativeSource FindAncestor,
AncestorType=TextBoxBase}" />
<Binding Path="MaxLength" RelativeSource="{RelativeSource FindAncestor, AncestorType=TextBoxBase}" />
</MultiBinding>
</Setter.Value>
</Setter>
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Visibility" Value="{Binding Path=(wpf:TextFieldAssist.CharacterCounterVisibility), RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type TextBox}}}" />
</Style> |
Thank you, @MichelMichels. I'll try that. |
@jamesport079 @MichelMichels It was actually an intended change to move all So I did not actually consider it a use case that consumers wanted to base a custom style on this one, but I am not against moving that style back out to the outer-most |
I'm using that particular style to make counter appear when the TextBox has Keyboard focus. I don't like it that I have a bunch of TextBoxes having the counters showing when they're not in focus. It just makes the UI unnecessarily cluttered. So yeah, ideally the Style remains accessible unless there is a neater solution. |
A neater solution would be to implement such a setting, like |
@MichelMichels yeah i thought about this way back. But not being able to access some styles in general irks me a little bit. |
@jamesport079 I understand your sentiment, but the style only makes sense in the context of a @nicolaihenriksen we could however revert the change and maybe propose the change for v6 as this seems to be a breaking change for @jamesport079 (and maybe other users)? |
Bug explanation
Application is crashing when I'm trying to use a style based on MaterialDesignCharacterCounterTextBlock. All worked well in 5.0 and below so I don't really know what is changed.
Exception: Cannot find resource named 'MaterialDesignCharacterCounterTextBlock'. Resource names are case sensitive.
I tried merging MaterialDesignTheme.TextBox.xaml but still getting the same error. Error only appeared after I updated to 5.1
This is my style based on MaterialDesignCharacterCounterTextBlock...
Version
5.1.0
The text was updated successfully, but these errors were encountered: