Click here to Skip to main content
16,021,905 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: WPF 3D rendering Pin
Gerry Schmitz2-May-23 6:14
mveGerry Schmitz2-May-23 6:14 
GeneralRe: WPF 3D rendering Pin
Kenneth Haugland2-May-23 9:59
mvaKenneth Haugland2-May-23 9:59 
AnswerRe: WPF 3D rendering Pin
RedDk2-May-23 8:03
RedDk2-May-23 8:03 
GeneralRe: WPF 3D rendering Pin
Kenneth Haugland2-May-23 10:01
mvaKenneth Haugland2-May-23 10:01 
QuestionExpander in ListBoxItem Width Problem Pin
Kevin Marois27-Apr-23 7:19
professionalKevin Marois27-Apr-23 7:19 
AnswerRe: Expander in ListBoxItem Width Problem Pin
Richard Deeming1-May-23 23:09
mveRichard Deeming1-May-23 23:09 
GeneralRe: Expander in ListBoxItem Width Problem Pin
Kevin Marois2-May-23 7:12
professionalKevin Marois2-May-23 7:12 
QuestionSpinning Indicator Control Error Pin
Kevin Marois26-Apr-23 14:32
professionalKevin Marois26-Apr-23 14:32 
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),
                new PropertyMetadata("", new PropertyChangedCallback(OnMessageChanged)));

    public string Message
    {
        get { return (string)GetValue(MessageProperty); }
        set { SetValue(MessageProperty, value); }
    }

    private static void OnMessageChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
    {
        var control = (MaroisSpinningProgress)d;
    }
    #endregion

    #region CTOR
    public MaroisSpinningProgress()
    {
        DefaultStyleKeyProperty.OverrideMetadata(typeof(MaroisSpinningProgress),
            new FrameworkPropertyMetadata(typeof(MaroisSpinningProgress)));
    }
    #endregion
}
XAML
<Style TargetType="{x:Type local:MaroisSpinningProgress}">

    <Setter Property="Template">

        <Setter.Value>

            <ControlTemplate TargetType="{x:Type local:MaroisSpinningProgress}">

                <Viewbox HorizontalAlignment="Center"
                        VerticalAlignment="Center">

                    <Grid Background="Transparent"
                        HorizontalAlignment="Center"
                        VerticalAlignment="Center">

                        <Grid.RowDefinitions>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>

                        <Canvas Name="Canvas1"<br />
                            RenderTransformOrigin="0.5,0.5"<br />
                            HorizontalAlignment="Center"<br />
                            VerticalAlignment="Center"
                            Width="120"
                            Height="120"
                            Margin="15">

                            <Canvas.RenderTransform>
                                <RotateTransform Angle="0" />
                            </Canvas.RenderTransform>

                            <Canvas.Style>
                                <Style TargetType="Canvas">
                                    <Style.Triggers>
                                        <Trigger Property="IsVisible" Value="True">
                                            <Trigger.EnterActions>
                                                <BeginStoryboard Name="Storyboard_Rotate">
                                                    <Storyboard RepeatBehavior="Forever">
                                                        <DoubleAnimation Storyboard.TargetProperty="RenderTransform.Angle"
                                                                        From="0"
                                                                        To="360"
                                                                        Duration="0:0:3"/>
                                                    </Storyboard>
                                                </BeginStoryboard>
                                            </Trigger.EnterActions>
                                            <Trigger.ExitActions>
                                                <StopStoryboard BeginStoryboardName="Storyboard_Rotate" />
                                            </Trigger.ExitActions>
                                        </Trigger>
                                    </Style.Triggers>
                                </Style>
                            </Canvas.Style>

                            <Ellipse Width="20" Height="20" Stretch="Fill" Fill="{Binding IndicatorColor, Mode=TwoWay}" Opacity="1.0" Canvas.Left="50" Canvas.Top="0" />
                            <Ellipse Width="20" Height="20" Stretch="Fill" Fill="{Binding IndicatorColor, Mode=TwoWay}" Opacity="0.9" Canvas.Left="20.6107373853764" Canvas.Top="9.54915028125262" />
                            <Ellipse Width="20" Height="20" Stretch="Fill" Fill="{Binding IndicatorColor, Mode=TwoWay}" Opacity="0.8" Canvas.Left="2.44717418524233" Canvas.Top="34.5491502812526" />
                            <Ellipse Width="20" Height="20" Stretch="Fill" Fill="{Binding IndicatorColor, Mode=TwoWay}" Opacity="0.7" Canvas.Left="2.44717418524232" Canvas.Top="65.4508497187474" />
                            <Ellipse Width="20" Height="20" Stretch="Fill" Fill="{Binding IndicatorColor, Mode=TwoWay}" Opacity="0.6" Canvas.Left="20.6107373853763" Canvas.Top="90.4508497187474" />
                            <Ellipse Width="20" Height="20" Stretch="Fill" Fill="{Binding IndicatorColor, Mode=TwoWay}" Opacity="0.5" Canvas.Left="50" Canvas.Top="100" />
                            <Ellipse Width="20" Height="20" Stretch="Fill" Fill="{Binding IndicatorColor, Mode=TwoWay}" Opacity="0.4" Canvas.Left="79.3892626146236" Canvas.Top="90.4508497187474" />
                            <Ellipse Width="20" Height="20" Stretch="Fill" Fill="{Binding IndicatorColor, Mode=TwoWay}" Opacity="0.3" Canvas.Left="97.5528258147577" Canvas.Top="65.4508497187474" />
                            <Ellipse Width="20" Height="20" Stretch="Fill" Fill="{Binding IndicatorColor, Mode=TwoWay}" Opacity="0.2" Canvas.Left="97.5528258147577" Canvas.Top="34.5491502812526" />

                        </Canvas>

                        <TextBlock Grid.Row="1"
                                Text="{Binding Message}"
                                FontSize="18"
                                Foreground="{Binding IndicatorTextColor}"
                                Visibility="{Binding IsShowingText}"/>

                    </Grid>

                </Viewbox>

            </ControlTemplate>

        </Setter.Value>

    </Setter>

</Style>
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.

AnswerRe: Spinning Indicator Control Error Pin
Gerry Schmitz27-Apr-23 7:01
mveGerry Schmitz27-Apr-23 7:01 
GeneralRe: Spinning Indicator Control Error Pin
Kevin Marois27-Apr-23 7:27
professionalKevin Marois27-Apr-23 7:27 
GeneralRe: Spinning Indicator Control Error Pin
Gerry Schmitz28-Apr-23 4:46
mveGerry Schmitz28-Apr-23 4:46 
GeneralRe: Spinning Indicator Control Error Pin
Kevin Marois28-Apr-23 7:24
professionalKevin Marois28-Apr-23 7:24 
QuestionFlat Button Style Problem Pin
Kevin Marois22-Apr-23 18:14
professionalKevin Marois22-Apr-23 18:14 
AnswerRe: Flat Button Style Problem Pin
Gerry Schmitz23-Apr-23 8:55
mveGerry Schmitz23-Apr-23 8:55 
GeneralRe: Flat Button Style Problem Pin
Kevin Marois23-Apr-23 9:15
professionalKevin Marois23-Apr-23 9:15 
GeneralRe: Flat Button Style Problem Pin
Gerry Schmitz23-Apr-23 15:28
mveGerry Schmitz23-Apr-23 15:28 
GeneralRe: Flat Button Style Problem Pin
Kevin Marois25-Apr-23 19:08
professionalKevin Marois25-Apr-23 19:08 
GeneralRe: Flat Button Style Problem Pin
Gerry Schmitz26-Apr-23 5:20
mveGerry Schmitz26-Apr-23 5:20 
QuestionReport Designer Suggestions Pin
Kevin Marois13-Apr-23 13:37
professionalKevin Marois13-Apr-23 13:37 
AnswerRe: Report Designer Suggestions Pin
Pete O'Hanlon13-Apr-23 21:23
mvePete O'Hanlon13-Apr-23 21:23 
AnswerRe: Report Designer Suggestions Pin
Gerry Schmitz14-Apr-23 3:51
mveGerry Schmitz14-Apr-23 3:51 
QuestionCustom Navigation Control Pin
Kevin Marois12-Apr-23 16:23
professionalKevin Marois12-Apr-23 16:23 
AnswerRe: Custom Navigation Control Pin
Pete O'Hanlon13-Apr-23 21:36
mvePete O'Hanlon13-Apr-23 21:36 
AnswerRe: Custom Navigation Control Pin
Richard Deeming13-Apr-23 22:47
mveRichard Deeming13-Apr-23 22:47 
GeneralRe: Custom Navigation Control Pin
Kevin Marois15-Apr-23 10:22
professionalKevin Marois15-Apr-23 10:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.