Click here to Skip to main content
15,915,093 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: Binding Enum to a ComboBox Pin
Kenneth Haugland31-May-13 21:05
mvaKenneth Haugland31-May-13 21:05 
QuestionData binding problem Pin
columbos1492728-May-13 3:12
columbos1492728-May-13 3:12 
AnswerRe: Data binding problem Pin
Abhinav S28-May-13 3:58
Abhinav S28-May-13 3:58 
QuestionNeed suggestion on application architecture. Pin
Beniston120528-May-13 0:05
Beniston120528-May-13 0:05 
AnswerRe: Need suggestion on application architecture. Pin
Abhinav S28-May-13 3:57
Abhinav S28-May-13 3:57 
GeneralRe: Need suggestion on application architecture. Pin
Beniston120528-May-13 20:14
Beniston120528-May-13 20:14 
AnswerRe: Need suggestion on application architecture. Pin
SledgeHammer0128-May-13 6:56
SledgeHammer0128-May-13 6:56 
GeneralRe: Need suggestion on application architecture. Pin
Beniston120528-May-13 20:14
Beniston120528-May-13 20:14 
AnswerRe: Need suggestion on application architecture. Pin
Mycroft Holmes28-May-13 14:13
professionalMycroft Holmes28-May-13 14:13 
QuestionOne data context for multiple Controls Pin
columbos1492727-May-13 22:55
columbos1492727-May-13 22:55 
AnswerRe: One data context for multiple Controls Pin
AlphaDeltaTheta28-May-13 1:13
AlphaDeltaTheta28-May-13 1:13 
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 

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.