【发布时间】:2017-10-06 13:42:22
【问题描述】:
如何将值与字体大小从组合框绑定到数据网格?我试过了,还是不行
<ComboBox Name="FontSizeComboBox" IsEditable="True"
Width="60" SelectedIndex="1"
Foreground="White">
<ComboBox.ItemsSource>
<x:Array Type="{x:Type System:Int32}">
<System:Int32>12</System:Int32>
<System:Int32>14</System:Int32>
<System:Int32>16</System:Int32>
<System:Int32>18</System:Int32>
<System:Int32>20</System:Int32>
<System:Int32>22</System:Int32>
<System:Int32>24</System:Int32>
<System:Int32>26</System:Int32>
<System:Int32>28</System:Int32>
</x:Array>
</ComboBox.ItemsSource>
</ComboBox>
<DataGrid Grid.Row="1" x:Name="dgrPoints" ItemsSource="{Binding Stations}" VerticalAlignment="Top" AutoGenerateColumns="False" CanUserResizeColumns="True"
FontSize="{Binding Path=SelectedIndex.Value ,ElementName=FontSizeComboBox}" CellEditEnding="dgrPoints_CellEditEnding">
【问题讨论】:
标签: c# wpf data-binding combobox datagrid