1
我已經XAML的片段:轉換ComboBox.TextBlock XAML到C#
<ComboBox
Name="comboBox1"
IsEditable="True"
Text="test"
TextBlock.TextAlignment="Right" />
如何將其轉換成C#?特別是,TextBlock.TextAlignment成爲什麼?
我已經XAML的片段:轉換ComboBox.TextBlock XAML到C#
<ComboBox
Name="comboBox1"
IsEditable="True"
Text="test"
TextBlock.TextAlignment="Right" />
如何將其轉換成C#?特別是,TextBlock.TextAlignment成爲什麼?
這是TextBlock的attached property,你必須在C#代碼中使用,在評論下面的代碼:
ComboBox cmb = new ComboBox();
cmb.Name = "comboBox1";
cmb.IsEditable = true;
cmb.Text = "Test";
TextBlock.SetTextAlignment(cmb, TextAlignment.Right); //here it is