Click here to Skip to main content
15,886,603 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: One data context for multiple Controls Pin
columbos1492728-May-13 3:07
columbos1492728-May-13 3:07 
QuestionRichtextbox text overlaps Pin
Antony_Christopher27-May-13 20:34
Antony_Christopher27-May-13 20:34 
QuestionSilverlight do we have a road map for the future Pin
Mycroft Holmes26-May-13 14:43
professionalMycroft Holmes26-May-13 14:43 
AnswerRe: Silverlight do we have a road map for the future Pin
SledgeHammer0128-May-13 6:54
SledgeHammer0128-May-13 6:54 
GeneralRe: Silverlight do we have a road map for the future Pin
Mycroft Holmes28-May-13 14:07
professionalMycroft Holmes28-May-13 14:07 
GeneralRe: Silverlight do we have a road map for the future Pin
_Maxxx_28-May-13 18:13
professional_Maxxx_28-May-13 18:13 
GeneralRe: Silverlight do we have a road map for the future Pin
Mycroft Holmes28-May-13 19:49
professionalMycroft Holmes28-May-13 19:49 
QuestionControl storyboard inside custom control...by code Pin
Jayme6524-May-13 2:25
Jayme6524-May-13 2:25 
Hello,
How do I please control (start, stop, pause, go to specific time) a controltemplate storyboard inside a custom control..by code?

The XAML:
XML
<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="Window6"
    Title="MainWindow" Height="394" Width="324">
    <Window.Resources>
        <!-- ********** Button template **********-->
        <Style x:Key="Arrow" TargetType="{x:Type Button}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}" x:Name="CTarrow">
                        <ControlTemplate.Resources>
                            <Storyboard x:Key="Storyboard1" RepeatBehavior="Forever" AutoReverse="True">
                                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="rectangle">
                                    <DiscreteColorKeyFrame KeyTime="0" Value="#FF0080FF"/>
                                    <DiscreteColorKeyFrame KeyTime="0:0:0.5" Value="#FF004D99"/>
                                    <DiscreteColorKeyFrame KeyTime="0:0:0.8" Value="#FF0080FF"/>
                                </ColorAnimationUsingKeyFrames>
                            </Storyboard>
                        </ControlTemplate.Resources>
                        <Grid>
                            <ContentPresenter RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="Center" VerticalAlignment="Center" />
                            <Rectangle x:Name="rectangle" Height="30" Width="50" Fill="Black" />
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>    
    </Window.Resources>
    
    <Grid>
          <Button HorizontalAlignment="Left" VerticalAlignment="Top" Style="{DynamicResource Arrow}" x:Name="Arrow" />
   </Grid>
</Window>



In these 3 attemps, the debugger complains about not being able to resolve 'rectangle':

VB
Dim myStoryboard As New Storyboard
myStoryboard = Arrow.FindResource("Storyboard1")
myStoryboard.Begin()


VB
Dim myStoryboard As New Storyboard
myStoryboard = CType(Me.Resources("Storyboard1"), Storyboard)
myStoryboard.Begin(Arrow)


VB
Dim myStoryboard As Storyboard = TryCast(Arrow.Template.Resources("Storyboard1"), Storyboard)
If myStoryboard IsNot Nothing Then
  myStoryboard.Begin(Arrow)
End If



With this one, I can verify that neither the template is not found:

VB
Dim ct As ControlTemplate = TryCast(Me.FindName("CTarrow"), ControlTemplate)
If ct IsNot Nothing Then
   Debug.Print("ControlTemplate found")
   Dim sb As Storyboard = TryCast(ct.Resources("Storyboard1"), Storyboard)
   If sb IsNot Nothing Then
     sb.Begin()
     Debug.Print("Storyboard found")
   End If
End If



Please help!! Wink | ;-)

modified 24-May-13 12:22pm.

QuestionBusiness Application Silverlight Pin
picasso223-May-13 17:09
picasso223-May-13 17:09 
QuestionWPF Formatted Large Amounts Of Text Pin
Kevin Marois23-May-13 12:29
professionalKevin Marois23-May-13 12:29 
AnswerRe: WPF Formatted Large Amounts Of Text Pin
Matt T Heffron23-May-13 15:18
professionalMatt T Heffron23-May-13 15:18 
GeneralRe: WPF Formatted Large Amounts Of Text Pin
Kevin Marois24-May-13 11:09
professionalKevin Marois24-May-13 11:09 
QuestionDatePicker in a WPF DataGrid Pin
NortonC23-May-13 4:29
NortonC23-May-13 4:29 
Questionabout datagrid of wpf Pin
ericibm22-May-13 22:22
ericibm22-May-13 22:22 
AnswerRe: about datagrid of wpf Pin
Mycroft Holmes23-May-13 0:21
professionalMycroft Holmes23-May-13 0:21 
QuestionSilverlight-Running SQL scripts Pin
picasso222-May-13 8:06
picasso222-May-13 8:06 
QuestionHow to trigger Datepicker validation error (WPF) Pin
TheHelenLee20-May-13 15:39
TheHelenLee20-May-13 15:39 
QuestionWPF Control - Enter Key Pin
NortonC20-May-13 4:45
NortonC20-May-13 4:45 
AnswerRe: WPF Control - Enter Key Pin
Mycroft Holmes20-May-13 12:31
professionalMycroft Holmes20-May-13 12:31 
AnswerRe: WPF Control - Enter Key Pin
AlphaDeltaTheta20-May-13 15:12
AlphaDeltaTheta20-May-13 15:12 
GeneralRe: WPF Control - Enter Key Pin
NortonC20-May-13 23:38
NortonC20-May-13 23:38 
GeneralRe: WPF Control - Enter Key Pin
AlphaDeltaTheta21-May-13 14:38
AlphaDeltaTheta21-May-13 14:38 
QuestionMVVM vs. MVVMP Pin
sthotakura20-May-13 0:45
sthotakura20-May-13 0:45 
AnswerRe: MVVM vs. MVVMP Pin
SledgeHammer0120-May-13 5:01
SledgeHammer0120-May-13 5:01 
AnswerRe: MVVM vs. MVVMP Pin
Abhinav S24-May-13 22:11
Abhinav S24-May-13 22:11 

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.