使用视框中我有ResourceFile1.xaml文件 其内容在资源字典文件
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Viewbox x:Key="Flash-On" >
<Grid Width="256" Height="256" Visibility="Visible">
<Path Tag="Icon" Data="F1M376.251,632.755L385.665,632.755 381.302,646.07 394.618,646.07 389.11,660.302 393.01,660.302 381.531,672.93 377.398,660.763 381.073,660.763 383.829,652.268 369.825,652.268 376.251,632.755z" Stretch="Uniform" Fill="#FFFFFFFF" Width="176" Height="176" Margin="0,0,0,0" RenderTransformOrigin="0.5,0.5">
<Path.RenderTransform>
<TransformGroup>
<TransformGroup.Children>
<RotateTransform Angle="0" />
<ScaleTransform ScaleX="1" ScaleY="1" />
</TransformGroup.Children>
</TransformGroup>
</Path.RenderTransform>
</Path>
</Grid>
</Viewbox>
<Viewbox x:Key="Flash-Off">
....
</Viewbox>
</ResourceDictionary>
代码为PhoneAppplicationPage
<phone:PhoneApplicationPage.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ResourceFile1.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</phone:PhoneApplicationPage.Resources>
但这种代码不工作。 设计器错误:InvalidOperationException:元素已经是另一个元素的子元素。 也<Button Content="{StaticResource Flash-On}"/>
如果我使用类似的代码 运行时错误:未能分配给属性'System.Windows.Controls.ContentControl.Content'。 如果viewbox在Grid.Resources中使用没有问题,但我想使用ResourceDictionary.how可以吗?
感谢工作正常,但不能使用转换器class.how与转换器类一起使用? – Oguzhan
您是否尝试过:''? –
not working.not binding Path = ?? – Oguzhan