- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如何解决由于以下样式导致的异常?
<Style x:Key="OnOffSwitchToggleButton" TargetType="{x:Type ToggleButton}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Grid Margin="0,0,0,-0.033">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.456*"/>
<ColumnDefinition Width="0.544*"/>
</Grid.ColumnDefinitions>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal">
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="Switch">
<EasingDoubleKeyFrame KeyTime="0" Value="0.083"/>
</DoubleAnimationUsingKeyFrames>
<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="path1">
<EasingColorKeyFrame KeyTime="0" Value="White"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="MouseOver">
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Effect).(DropShadowEffect.Opacity)" Storyboard.TargetName="path">
<EasingDoubleKeyFrame KeyTime="0" Value="1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed"/>
<VisualState x:Name="Disabled"/>
</VisualStateGroup>
<VisualStateGroup x:Name="CheckStates">
<VisualState x:Name="Checked">
<Storyboard>
<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="path">
<EasingColorKeyFrame KeyTime="0:0:0.2" Value="#FF39B54A"/>
</ColorAnimationUsingKeyFrames>
<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)" Storyboard.TargetName="path">
<EasingColorKeyFrame KeyTime="0:0:0.2" Value="#FF319D40"/>
</ColorAnimationUsingKeyFrames>
<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="label">
<EasingColorKeyFrame KeyTime="0" Value="#00999999"/>
<DiscreteColorKeyFrame KeyTime="0:0:0.2" Value="#0039B54A"/>
<EasingColorKeyFrame KeyTime="0:0:0.3" Value="White"/>
</ColorAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(ContentControl.Content)" Storyboard.TargetName="label">
<DiscreteObjectKeyFrame KeyTime="0:0:0.2" Value="ON"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.HorizontalAlignment)" Storyboard.TargetName="Switch">
<DiscreteObjectKeyFrame KeyTime="0:0:0.2" Value="{x:Static HorizontalAlignment.Left}"/>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="Switch">
<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="39.965"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="label">
<DiscreteDoubleKeyFrame KeyTime="0:0:0.2" Value="-19.224"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Unchecked">
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="Switch">
<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="label">
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
<DiscreteDoubleKeyFrame KeyTime="0:0:0.2" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="label">
<EasingColorKeyFrame KeyTime="0" Value="#00999999"/>
<EasingColorKeyFrame KeyTime="0:0:0.2" Value="#00999999"/>
<EasingColorKeyFrame KeyTime="0:0:0.3" Value="#FF999999"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Indeterminate"/>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Canvas x:Name="_switch" UseLayoutRounding="False" Height="30" Width="70" d:LayoutOverrides="VerticalMargin" Grid.ColumnSpan="2">
<Canvas x:Name="Background" Height="30" Canvas.Left="0" Canvas.Top="0" Width="70" RenderTransformOrigin="0.5,0.5">
<Canvas.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</Canvas.RenderTransform>
<Path x:Name="path" Height="30" Canvas.Left="0" Canvas.Top="0" Width="70" Data="F1M55.0161,-0.966799999999999L14.9831,-0.966799999999999C6.7081,-0.966799999999999,0.00010000000000332,5.7412,0.00010000000000332,14.0162C0.00010000000000332,22.2922,6.7081,29.0002,14.9831,29.0002L55.0161,29.0002C63.2911,29.0002,70.0001,22.2922,70.0001,14.0162C70.0001,5.7412,63.2911,-0.966799999999999,55.0161,-0.966799999999999" Fill="#FFEDEDED" Stretch="Fill" Stroke="#FFCCCCCC">
<Path.Effect>
<DropShadowEffect ShadowDepth="0" Color="#FF00ADEF" Opacity="0"/>
</Path.Effect>
</Path>
</Canvas>
<Grid x:Name="Switch" Height="22" Canvas.Left="4.815" Canvas.Top="3.568" Width="22" RenderTransformOrigin="0.5,0.5">
<Grid.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</Grid.RenderTransform>
<Grid.Effect>
<DropShadowEffect BlurRadius="3" ShadowDepth="0" Opacity="0.5"/>
</Grid.Effect>
<Path x:Name="path1" Data="F1M14.9614,27.0166C7.7934,27.0166,1.9614,21.1846,1.9614,14.0166C1.9614,6.8486,7.7934,1.0166,14.9614,1.0166C22.1294,1.0166,27.9614,6.8486,27.9614,14.0166C27.9614,21.1846,22.1294,27.0166,14.9614,27.0166" Height="22" Stretch="Fill" Width="22" Margin="0" Fill="White"/>
</Grid>
</Canvas>
<Label x:Name="label" Content="OFF" Grid.Column="1" Margin="-2.506,2,0,0" HorizontalAlignment="Left" Padding="0" VerticalAlignment="Center" FontFamily="Avenir 45" FontSize="14.667" Foreground="#FF999999" RenderTransformOrigin="0.5,0.5">
<Label.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</Label.RenderTransform>
</Label>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="HorizontalAlignment" Value="Left"/>
</Style>
我将此样式应用于网格单元格内的切换按钮:
<ToggleButton Grid.Column="1" IsChecked="{Binding Path=ObjectStatus}" Style="{StaticResource ResourceKey=OnOffSwitchToggleButton}" Margin="5,0,0,0"/>
我在 devexpress GridControl 中有另一个切换按钮,但没有出现此异常。
最佳答案
正如约翰所说,错误就在这一行
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="Switch">
无法遍历和查找 switch 中的属性,因此解决方案是为转换命名,然后直接引用转换
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(TranslateTransform.Y)" Storyboard.TargetName="SwitchTranslate">
和
<Grid x:Name="Switch" Height="22" Canvas.Left="4.815" Canvas.Top="3.568" Width="22" RenderTransformOrigin="0.5,0.5">
<Grid.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform x:Name="SwitchTranslate"/>
</TransformGroup>
关于c# - '[未知 ]' property does not point to a DependencyObject in path ' (0).(1)[3].(2)',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13168740/
我正在创建一个基于 TreeView 的可重用自定义控件。我在自定义控件上为控件中的列创建了一个依赖属性,如下所示: public GridViewColumnCollection Colum
仅当我将这些行添加到 OnRender 覆盖方法时才会出现此错误: for (int i = 0; i < this.Width; i++) { dc.DrawImage(Gouttes[i]
我在 WPF 应用程序的单独线程中执行冗长的操作(连接测试、远程数据库表验证等)。在测试期间,我为用户收集关于哪些测试通过了哪些没有通过的信息。信息存储为 List我自己设计的对象: public c
我正在尝试使用 coding4fun toolkit适用于 Windows Phone 7。 InputPrompt input = new InputPrompt(); whoAreYou.Comp
我遇到了 StackOverflowException,这让我发现 DependencyObject 没有正确处理相等性?! 当 DependencyProperty 的类型为 Object 时,它将
XAML 允许我将属性附加到不是从 DependencyObject 派生的类型。例如,我可以为窗口上的 CommandBindings 指定名称: 我在 MSDN ( Attache
我正在努力寻找有关 DependencyObject 使用的属性继承树(或继承上下文)的足够信息。和 DependencyProperty . 我想使用DependencyProperty的值继承能力
我得到了我创建的自定义 DependencyObjects 的集合。但我认为 DependencyObject 来自哪里并不重要。问题是我想要列出它的属性,但是当我查看 DependencyObjec
我有以下代码,它创建一个临时文件夹并使用 FileSystemWatcher 轮询添加到 Location 属性文件夹中的文件,并将它们添加到列表中:Scratchdisk.cs on Pastebi
基于documentation通过 MSDN... You can also use InvalidateProperty to force re-evaluation of a binding ag
我是 WPF 的新手,这是我的第一篇文章。我创建了一个名为“Fruit”的类,它派生自“DependencyObject”并添加了名为“Apple”的额外属性。我创建了一个新的自定义控件,其中包含一个
我有一组绑定(bind)到数据的控件,我想以编程方式将验证器添加到绑定(bind)中。目前,我能够遍历可视化树以找到具有绑定(bind)的控件,并将我的验证器添加到这些控件中。但是为了进一步指定哪些控
我的 XAML 中有这个非常简单的组合框: 这是我背后的代码: public class Test //: System.Windows.DependencyObject { public
如果我的“可见性”(在这种情况下只是一个 bool 值)属性为假,我正在尝试编写客户行为以将某些列宽设置为 0...我的问题是,当我的 on changed 事件触发它时,我的 AssociatedO
我想尝试能够有一个转换器,其参数可以与当前数据上下文绑定(bind)。谁能告诉我为什么到达 Convert() 函数时,Source 属性始终为空? namespace WpfApplication3
一段时间以来,我一直在使用 NUnit 和 Moq 以及我的 Silverlight 代码编写单元测试。我一直遇到的一个问题与 DependencyObjects 有关。 如果有任何东西是从 Depe
WPF - 我正在使用 BackgroundWorker 创建一个 Model3D 对象,但是当我想将它添加到 XAML 中定义的 Model3DGroup 时,出现异常: Cannot use a
我正在创建一个应该在空 XAML 文件中使用的自定义时间: A string 我如何有效地允许我的自定义类 BlackAndWhite 窗口(继承自 DependencyObject 和
我有一个 wpf 表单,我想在用户从控件中做出选择时立即显示加载弹出窗口,因为数据加载可能需要很长时间才能看到,因为数据库不是本地的。在我为弹出窗口创建线程之前,我已经完成了所有工作。 这是我创建线程
我有一个用 wpf 编写的应用程序,它下载一些网页,解析 html 代码并保存一些值。 class ListOfItems { public List ListToBind; p
我是一名优秀的程序员,十分优秀!