4

I'm relatively new to WPF and I would like to add a loading indicator. I found https://github.com/100GPing100/LoadingIndicators.WPF which has some nice pre-made loading indicators and I installed the NuGet Package for it but I'm having a hard time implementing them to my window.

So I added

<Window ...
    xmlns:loadin="clr-namespace:LoadingIndicators.WPF;assembly=LoadingIndicators.WPF"
    ...
>

Window.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="pack://application:,,,/LoadingIndicators.WPF;component/Styles/LoadingDoubleBounce.xaml"/>
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Window.Resources>

But when I try to add one of the loading indicators to my grid I get an error on the dynamic resource

<Grid x:Name="TagLoadingIndicator" Panel.ZIndex="1">
    <loadin:LoadingIndicator SpeedRatio="{Binding SpeedRatio}" IsActive="{Binding IsDoubleBounceActive}" Style="{DynamicResource LoadingIndicatorDoubleBounceStyle}"/>
</Grid>

The error I get is

The resource "LoadingIndicatorDoubleBounceStyle" could not be resolved.

From what I saw in other websites, I am adding it to the ResourceDictionary correctly... And I'm assuming that by installing the NuGet package, I have the resource already defined. I can still run the application but the indicator is missing. What am I missing?

Thank you

1 Answer 1

6

That key exists in the Styles.xaml file. So add a reference to it in your resources.

<Window.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="pack://application:,,,/LoadingIndicators.WPF;component/Styles/LoadingDoubleBounce.xaml"/>
            <ResourceDictionary Source="pack://application:,,,/LoadingIndicators.WPF;component/Styles.xaml"/>
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
 </Window.Resources>
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you! I didn't see that as on of the references in the demo code. It's working now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.