2

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'.

<DataTemplate x:Key="ContentDetail">
        <DataTemplate.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>
        </DataTemplate.Resources>
        <StackPanel  Orientation="Horizontal" Height="500" >
            <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 >


<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseLeftButtonDown">
    <command:EventToCommand Command="{Binding ElementName=MainStack,Path=DataContext.CallLogOnCommand}" />
</i:EventTrigger>
<ei:DataTrigger Binding="{Binding ElementName=MainStack,Path=DataContext.CallLogOn, Mode=OneWay}" Value="ON">
    <ei:ControlStoryboardAction Storyboard="{StaticResource StoryCallLogOn}" ControlStoryboardOption="Play"/>
</ei:DataTrigger>

The storyboard is getting called with no problem. But for some reason even though the storyboard is in the DataTemplate.Resources it cannot see my GridControl named gridCallLog. Any pointers would be gratefully accepted. Scott

4

1 回答 1

3

您应该将资源添加到内部的控件之一中DataTemplate,而不是DataTemplate本身:

<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 >
于 2013-10-23T04:53:28.833 回答