[英]How Would You Convert this WPF to Silverlight
幫我將此WPF轉換為Silverlight
我對展示如何制作魚眼效果的Charles Petzold C#示例感興趣( http://www.charlespetzold.com/blog/2009/05/Realizing-a-Fisheye-Effect-in-Silverlight.html )。 XAML代碼示例在WPF中,但是我想在Silverlight中嘗試。
當我嘗試在Silverlight中創建XAML代碼時,編譯器在兩個位置抱怨:
<Style TargetType="{x:Type Button}">
Error 1 The type 'x:Type' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.
<Style.Triggers>
Error 2 The attachable property 'Triggers' was not found in type 'Style'.
如何將其轉換為Silverlight?
不要在Silverlight中使用x:Type
,它不支持該標記擴展。 只需使用<Style TargetType="Button">
。 至於觸發器,您可以直接在控件xaml中使用它們,而不必使用樣式。
<Button>
<Button.Triggers>
</Button.Triggers>
</Button>
在第一種情況下,您可以將Button
放在范圍內,
<Style TargetType="Button">
但是在第二種情況下,Silverlight不(完全)支持Triggers
,因此您可能需要在適當的事件處理程序中(在代碼中)實現所有發生的事情。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.