(VS express2012,WPF,.net4.5) 我是新來的C#開發。 我目前正在開發使用Kinect的SDK 1.7屬性添加到KinectTileButton
我想在運行時,但不知道該風格KinectTileButton怎麼樣,我曾嘗試在堆棧中發現的各種解決方案,但都沒有工作過一個Windows應用程序,我假定這可能是由於由於我缺乏C#知識,所以請爲傻瓜提供答案。
XAML標記是:
<k:KinectTileButton Background="{x:Null}"
BorderThickness="3" Height="Auto" Margin="50,0"
BorderBrush="#FF181919" Width="Auto" />
問題是KTB的在運行時動態創建。 在後面的代碼:
for (var index = 0; index < 300; ++index)
{
var button = new KinectTileButton();
this.Width = Double.NaN;
Image img = new Image();
if (files[fileindex].FullName.EndsWith(".jpg"))
img.Source = new BitmapImage(new Uri(files[fileindex].FullName));
button.Content = img;
this.wrapPanel.Children.Add(button);
fileindex++;
if (fileindex >= files.Length)
fileindex = 0;
}
我修改了代碼,也許它可以幫助那些有MS Kinect的開發誰的arent,偉大的C#。
稍微修改一下,並從一些這方面的幫助,之後就是我的風格的KTB
var button = new KinectTileButton();
button.Background = null;
button.Margin = new Thickness(40);
button.Height = Double.NaN;
button.Width = Double.NaN;
button.BorderBrush = Brushes.Transparent;
你怎麼想的樣式KTB? – 2013-05-06 12:50:41
就像在xaml標記中顯示的樣式一樣。 – Det 2013-05-06 13:10:34
'button.Background = null; button.BorderThickness = 3; button.Height = Double.NaN;'aso .. – 2013-05-06 13:16:21