Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

WPF UserControl Resource Self Binding

$
0
0

I am trying to determine the best way to use a Storyboard on the custom UserControl that is configured in the Resource section of the custom UserControl.  Basically the usercontrol has some dependency properties on it that when modified, I will be executing various different storyboards against the usercontrol itself.  I'm not fond of using the Storyboard.TargetName property to access the UserControl, but that seams to be the only way that I can get this functionality to work.  Every time I try to use the RelativeSource binding an error is raised as run-time about the Target not being bound.  I could be completely off base here in the direction I'm headed so if there is a better way to storyboard the usercontrol I'm interested...

<UserControl x:Class="Controls.Progress"             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"              xmlns:d="http://schemas.microsoft.com/expression/blend/2008"              xmlns:this="clr-namespace:Controls"             mc:Ignorable="d" x:Name="thisProgress">    <UserControl.Resources>        <ResourceDictionary>            <Storyboard x:Key="ShowRefresh">                <!--<DoubleAnimation Storyboard.Target="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"-->                <!--<DoubleAnimation Storyboard.Target="{Binding RelativeSource={RelativeSource AncestorType={x:Type this:Progress}}}"-->                <DoubleAnimation Storyboard.TargetName="thisProgress"                                 Storyboard.TargetProperty="Opacity"                                 From="0" To=".5" Duration="0:0:0.1" />            </Storyboard>


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>