Calling Storyboard inside DataTemplate

前端 未结 1 1548
北恋
北恋 2021-01-23 07:13

I am getting a constant error with my code that I can;t figure out.

No applicable name scope exists to resolve the name \'gridCallLog\'.

相关标签:
1条回答
  • 2021-01-23 08:10

    You should add the resource into one of the control that is inside the DataTemplate, instead of in the DataTemplate itself:

    <DataTemplate x:Key="ContentDetail">
            <StackPanel Orientation="Horizontal" Height="500" >
            <StackPanel.Resources>
                <Storyboard x:Key="StoryCallLogOn">
                    <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="gridCallLog">
                        <EasingThicknessKeyFrame KeyTime="0" Value="0,0,10,23.04"/>
                        <EasingThicknessKeyFrame KeyTime="0:0:0.6" Value="0,0,10,200"/>
                    </ThicknessAnimationUsingKeyFrames>
                    <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="borderCallLog">
                        <EasingThicknessKeyFrame KeyTime="0" Value="0,402,10,23.04"/>
                        <EasingThicknessKeyFrame KeyTime="0:0:0.6" Value="0,225,10,23.04"/>
                    </ThicknessAnimationUsingKeyFrames>
                </Storyboard>
            </StackPanel.Resources>
            <Border Margin="10,5,0,10" BorderBrush="Transparent" CornerRadius="3" BorderThickness="1" Width="1050">
                <StackPanel Margin="5,5,9,5" Orientation="Horizontal">
                    <dx:DXTabControl Width="850" Margin="5,5,0,0">
                        <dx:DXTabItem Header="Call Log">
                            <StackPanel>
                                <dxg:GridControl x:Name="gridCallLog" Height="400" ItemsSource="{Binding ElementName=MainStack,Path=DataContext.CallLog}"  
                                dx:ThemeManager.ThemeName="Office2010Blue" Margin="0,0,10,0" SelectedItem="{Binding ElementName=MainStack,Path=DataContext.SelectedCallLog,UpdateSourceTrigger=PropertyChanged}" >
                                    <dxg:GridControl.Columns >
    
    0 讨论(0)
提交回复
热议问题