Note that there are some explanatory texts on larger screens.

plurals
  1. POWPF custom control style only applied on certain computers
    primarykey
    data
    text
    <p>I've been writing a WPF program at work that uses a custom <code>AnimatedScrollViewer</code>control, inheriting from <code>ScrollViewer</code>. It has the following default template:</p> <pre><code>&lt;Style TargetType="{x:Type Controls:AnimatedScrollViewer}"&gt; &lt;Setter Property="Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType="{x:Type Controls:AnimatedScrollViewer}"&gt; &lt;Grid x:Name="PART_LayoutRoot"&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="*" /&gt; &lt;RowDefinition Height="Auto" /&gt; &lt;/Grid.RowDefinitions&gt; &lt;ScrollContentPresenter x:Name="PART_ScrollContentPresenter" /&gt; &lt;Grid Grid.Row="1"&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="*" /&gt; &lt;ColumnDefinition Width="Auto" /&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;ScrollBar x:Name="PART_HorizontalScrollBar" Orientation="Horizontal" IsEnabled="{TemplateBinding IsPaused}" Value="{TemplateBinding HorizontalOffset}" Maximum="{TemplateBinding ScrollableWidth}" ViewportSize="{TemplateBinding ViewportWidth}" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" /&gt; &lt;StackPanel Grid.Column="1"&gt; &lt;Image Source="{StaticResource LockedImage}" Visibility="{TemplateBinding IsPlaying, Converter={StaticResource boolToVisConverter}}"/&gt; &lt;Image Source="{StaticResource UnlockedImage}" Visibility="{TemplateBinding IsPaused, Converter={StaticResource boolToVisConverter}}"/&gt; &lt;/StackPanel&gt; &lt;/Grid&gt; &lt;/Grid&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; </code></pre> <p>I'm setting this as the default style using:</p> <pre><code>[...] public class AnimatedScrollViewer : ScrollViewer { static AnimatedScrollViewer() { DefaultStyleKeyProperty.OverrideMetadata(typeof(AnimatedScrollViewer), new FrameworkPropertyMetadata(typeof(AnimatedScrollViewer))); } [...] </code></pre> <p>The style is being referenced in the below <code>Generic.xaml</code> dictionary, which in turn is referenced as a <code>MergedDictionary</code> in <code>App.xaml</code>:</p> <pre><code>&lt;ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt; &lt;ResourceDictionary.MergedDictionaries&gt; &lt;ResourceDictionary Source="ConvertersDictionary.xaml" /&gt; &lt;ResourceDictionary Source="pack://application:,,,/JamesWright.Utils.EndpointCaller.Views;component/Themes/EndpointStyles.xaml" /&gt; &lt;ResourceDictionary Source="pack://application:,,,/JamesWright.Utils.EndpointCaller.Views;component/Themes/ImageResources.xaml" /&gt; &lt;ResourceDictionary Source="pack://application:,,,/JamesWright.Utils.EndpointCaller.Views;component/Themes/Resources.xaml" /&gt; &lt;ResourceDictionary Source="pack://application:,,,/JamesWright.Utils.EndpointCaller.Views;component/Controls/AnimatedScrollViewer.xaml" /&gt; &lt;/ResourceDictionary.MergedDictionaries&gt; &lt;/ResourceDictionary&gt; </code></pre> <p>What's really strange is that the style is only applied to the control when the program runs on my own machine and a Windows 8.1 virtual machine, while it isn't applied on my colleague's computer and a team machine. I know that the style isn't applied because the associated <code>ScrollBar</code> should only be enabled when 'IsPaused' is true. On my colleague's machine, however, it's always enabled. Also, the images that I've specified in the template don't appear as a result.</p> <p>Are there any known reasons why a <code>Style</code> may not be applied on certain machines? I've decompiled the app and the resources are referencing the correct files. Any help is appreciated, as we've been pulling our hair out all day :P</p> <p><strong>UPDATE:</strong> I've downloaded it to my Windows 8 laptop and the style is applied correctly.</p> <p><strong>UPDATE #2:</strong> I attempted to use relative paths as opposed to <code>pack</code> syntax with no success</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload