Spinning Indicator Control Error
-
I have a spinning indicator custom control[^]. It's currently in a UserControl that works fine. But now I want to put it in a CustomControl instead. It's throwing this exception. If I comment out the DoubleAnimation then it doesn't throw, but it also doesn't show anything.
Cannot resolve all property references in the property path 'RenderTransform.Angle'. Verify that applicable objects support the properties.
Inner Exception 1:
InvalidOperationException: Cannot resolve all property references in the property path 'RenderTransform.Angle'. Verify that applicable objects support the properties.I'm stumped on this. Anyone know what's wrong? Code behind It has properties for the Indicator Color, Indicator Text Color, and Message:
public class MaroisSpinningProgress : ControlBase
{
#region DP IndicatorColor
public static readonly DependencyProperty IndicatorColorProperty =
DependencyProperty.Register("IndicatorColor",
typeof(SolidColorBrush),
typeof(MaroisSpinningProgress),
new PropertyMetadata(new SolidColorBrush(Colors.Black), new PropertyChangedCallback(OnIndicatorColorChanged)));public SolidColorBrush IndicatorColor { get { return (SolidColorBrush)GetValue(IndicatorColorProperty); } set { SetValue(IndicatorColorProperty, value); } } private static void OnIndicatorColorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var control = (MaroisSpinningProgress)d; } #endregion #region DP IndicatorTextColor public static readonly DependencyProperty IndicatorTextColorProperty = DependencyProperty.Register("IndicatorTextColor", typeof(SolidColorBrush), typeof(MaroisSpinningProgress), new PropertyMetadata(new SolidColorBrush(Colors.Black))); public SolidColorBrush IndicatorTextColor { get { return (SolidColorBrush)GetValue(IndicatorTextColorProperty); } set { SetValue(IndicatorTextColorProperty, value); } } #endregion #region DP Message public static readonly DependencyProperty MessageProperty = DependencyProperty.Register("Message", typeof(string), typeof(MaroisSpinningProgress),
-
I have a spinning indicator custom control[^]. It's currently in a UserControl that works fine. But now I want to put it in a CustomControl instead. It's throwing this exception. If I comment out the DoubleAnimation then it doesn't throw, but it also doesn't show anything.
Cannot resolve all property references in the property path 'RenderTransform.Angle'. Verify that applicable objects support the properties.
Inner Exception 1:
InvalidOperationException: Cannot resolve all property references in the property path 'RenderTransform.Angle'. Verify that applicable objects support the properties.I'm stumped on this. Anyone know what's wrong? Code behind It has properties for the Indicator Color, Indicator Text Color, and Message:
public class MaroisSpinningProgress : ControlBase
{
#region DP IndicatorColor
public static readonly DependencyProperty IndicatorColorProperty =
DependencyProperty.Register("IndicatorColor",
typeof(SolidColorBrush),
typeof(MaroisSpinningProgress),
new PropertyMetadata(new SolidColorBrush(Colors.Black), new PropertyChangedCallback(OnIndicatorColorChanged)));public SolidColorBrush IndicatorColor { get { return (SolidColorBrush)GetValue(IndicatorColorProperty); } set { SetValue(IndicatorColorProperty, value); } } private static void OnIndicatorColorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var control = (MaroisSpinningProgress)d; } #endregion #region DP IndicatorTextColor public static readonly DependencyProperty IndicatorTextColorProperty = DependencyProperty.Register("IndicatorTextColor", typeof(SolidColorBrush), typeof(MaroisSpinningProgress), new PropertyMetadata(new SolidColorBrush(Colors.Black))); public SolidColorBrush IndicatorTextColor { get { return (SolidColorBrush)GetValue(IndicatorTextColorProperty); } set { SetValue(IndicatorTextColorProperty, value); } } #endregion #region DP Message public static readonly DependencyProperty MessageProperty = DependencyProperty.Register("Message", typeof(string), typeof(MaroisSpinningProgress),
The "target" is the RotateTransform; the "target property" is "Angle".
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
-
The "target" is the RotateTransform; the "target property" is "Angle".
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
I'm sorry, I don't think I understand. Isn't that what I have here
and here
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
-
I'm sorry, I don't think I understand. Isn't that what I have here
and here
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
You give the RotateTransform a "Name"; then reference it in "TargetName" of the StoryBoard. Where in "RenderTransform" (abstract Transform) is there an "Angle" property?
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
-
You give the RotateTransform a "Name"; then reference it in "TargetName" of the StoryBoard. Where in "RenderTransform" (abstract Transform) is there an "Angle" property?
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
[UPDATE] I found this[^] which works fine. Thanks OK, so I see where you're going with this, except this:
results in the compilation error
TargetName property cannot be set on a Style Setter.
I understand what do do, just not how to do it. As I noted in my posting this is working as a UserControl in production. Here I'm trying to put it into a CustomControl library. I'm wondering if that has some effect I'm not seeing. I put it in a repository here[^]
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
-
[UPDATE] I found this[^] which works fine. Thanks OK, so I see where you're going with this, except this:
results in the compilation error
TargetName property cannot be set on a Style Setter.
I understand what do do, just not how to do it. As I noted in my posting this is working as a UserControl in production. Here I'm trying to put it into a CustomControl library. I'm wondering if that has some effect I'm not seeing. I put it in a repository here[^]
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
This gets into the whole philosophy of when to use a custom control, user control and style versus content; which we differ on. From a "logical" and technical point of view your "target" is the RotateTransform. The fact your user control works testifies to the fact they are different (and easier to implement) and / or you got lucky with the XAML parser. (You're effectively creating a "progress ring" which can be found in the Community Toolkit).
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
-
You give the RotateTransform a "Name"; then reference it in "TargetName" of the StoryBoard. Where in "RenderTransform" (abstract Transform) is there an "Angle" property?
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
My message dissappeared :confused::confused::confused: Anyhow, I have been slowly developing my own custom control library and I was hoping to port this to it. I guess I'll leave it in a UserControl. I knew about the Community Toolkit, and also, here's a cool implementation with very little code[^] Thanks
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.