2010年12月
« 11月   1月 »
 12345
6789101112
13141516171819
20212223242526
2728293031  

[Silverlight] DependencyPropertyの登録方法

7:41 PM on 2010年12月10日 ,

public class MyClass : DependencyObject { public MyClass() { } public string Test { get { return (string)GetValue(TestProperty); } set { SetValue(TestProperty, value); } } public static readonly DependencyProperty TestProperty = DependencyProperty.Register(“Test”, typeof(string), typeof(MyClass), new PropertyMetadata(“”)); } (参考) http://msdn.microsoft.com/ja-jp/library/system.windows.dependencyproperty.register%28VS.80%29.aspx

[Silverlight] マウスホイールイベントを取得

7:38 PM ,

public MainPage() { InitializeComponent(); HtmlPage.Window.AttachEvent(“DOMMouseScroll”, OnMouseWheel); HtmlPage.Window.AttachEvent(“onmousewheel”, OnMouseWheel); HtmlPage.Document.AttachEvent(“onmousewheel”, OnMouseWheel); } private void OnMouseWheel(object sender, HtmlEventArgs args) { ScriptObject e = args.EventObject; if (e.GetProperty(“wheelDelta”) != null) { // IE・Opera } else if (e.GetProperty(“detail”) != null) { // Mozilla・Safari } }

[Silverlight] コード側からStoryBoardを生成

7:34 PM ,

// ボタンを拡大表示するStoryboard生成 private void CreateStoryboard(Button btn) { Storyboard sb = new Storyboard(); // 幅変更DoubleAnimation DoubleAnimation animationWidth = new DoubleAnimation() { Duration = TimeSpan.FromSeconds(1.0), From = 50.0, To = 100.0, EasingFunction = new BackEase() { Amplitude = 1, EasingMode = EasingMode.EaseInOut, } }; // 高さ変更DoubleAnimation DoubleAnimation animationHeight = new DoubleAnimation() { Duration = TimeSpan.FromSeconds(1.0), From = [...]