我有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>
Run Code Online (Sandbox Code Playgroud)
PhoneAppplicationPage的代码
<phone:PhoneApplicationPage.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ResourceFile1.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</phone:PhoneApplicationPage.Resources>
Run Code Online (Sandbox Code Playgroud)
但这个代码不起作用.Designer Error:InvalidOperationException:Element已经是另一个元素的子元素.还有<Button Content="{StaticResource Flash-On}"/>如果我使用类似的代码运行时错误:无法分配财产"System.Windows.Controls.ContentControl.Content".如果Viewbox在Grid.Resources中使用没有问题可以正常工作,但我想使用ResourceDictionary.how我可以吗?
我想将回调函数类型转换为另一种类型。例如,用快递。
//definitions.ts
interface ExtendedRequest extends express.Request{
user:IUser;
}
interface ExtendedRequestHandler{
(req:ExtendedRequest, res:express.Response, next:express.NextFunction):any;
}
//app.ts
import * as D from './definitions';
...
// if i use with 'function' keyword it works
app.post('/login', <D.ExtendedRequestHandler>function(req,res){/*..*/});
//but if i try casting on anonymous arrow function, it doesnt work,
//i am getting error ',' expected
app.post('/login', <D.ExtendedRequestHandler>(req,res)=>{/*..*/});
Run Code Online (Sandbox Code Playgroud)
有没有办法在箭头函数上应用类型转换?
谢谢..