完璧な備忘録です、ええ
1.C#からのUIElement色変え
クリックしたときに色が変わる等、動的にオブジェクトの色を変えたいときはC#から色の変更処理を行う必要がある。
tb.Foreground = new SolidColorBrush(Colors.Black);
tb.Foreground = new SolidColorBrush(Colors.White);
tb.Foreground = new SolidColorBrush(Colors.Blue);
C#で色の指定を行うときは、SolidColorBrushから行う。
2.フォルダから画像を読み込んでImageのソースに代入するとき
こちらも単純に画像のURLを渡すだけではダメ。
img.Source = new BitmapImage(new Uri("image/PictureFolder.png", UriKind.RelativeOrAbsolute));
こんな感じに一度BitmapImageを作成してからImage.Sourceに代入してあげる
以上、備忘録でした
0 comments:
Post a Comment