일부 아이콘을 동적으로 추가하려는 스택 패널이 있습니다.이미지 추가 F #
이// assuming stackPanel is my stack panel
let text = new TextBlock()
text.Text <- "Test"
stackPanel.Children.add(text)
하지만, 내 목표는 이미지를 추가하는 것입니다,하지만 이미지
let getImageSource(imagePath) =
let uri = new Uri(imagePath, UriKind.Relative)
new BitmapImage(uri);
let icon = new Image()
icon.Source <- getImageSource("images/fileIcon/icon.gif")
stackPanel.Children.Add(icon) // this doesnt work
를 해결하지 못하는 것 같다 :
내가 스택 패널에있는 TextBlock을 추가하면 완벽하게 작동
내가 할 지금 때
let icon = new Image()
icon.Source <- getImageSource("images/fileIcon/icon.gif")
stackPanel.Children.Add(icon)
let text = new TextBlock()
text.Text <- "Test"
stackPanel.Children.add(text)
빈 IMAG이있는 것처럼 나는 텍스트 사이의 빈 공간이, 거기에 볼 수 있습니다
거기에. 내 생각 엔 이미지 경로를 해결하는 방식에 문제가있는 것 같지만 그 이유는 확실하지 않습니다.
생각하십니까?
감사합니다.
GIF에 대해 깨닫지 못했습니다 ... 문제는 GIF 때문이었습니다. –