前台代码
<Grid Margin="-20 0 0 0" > <Grid.ColumnDefinitions> <ColumnDefinition Width="130"/> <ColumnDefinition Width="100"/> <ColumnDefinition Width="100"/> </Grid.ColumnDefinitions> <Label Grid.Column="0" Margin="-15 0 0 0" Content="提醒时限" ContentStringFormat="{}{0}:" Style="{StaticResource LableEditStyle}"/> <dxe:TextEdit x:Name="txtConTxsx" Grid.Column="1" Width="98" Margin="-20 0 0 0" HorizontalAlignment="Left" Style="{StaticResource TextEditCommonStyle}" Mask=" +?[0-9]d*" MaskType="RegEx" LostFocus="txtConTxsx_LostFocus"/> <ComboBox x:Name="cb_unit_txsx" Grid.Column="2" Width="98" Height="23" Margin="-20 0 0 0" FontSize="14" VerticalAlignment="Center" HorizontalAlignment="Left" SelectedIndex="0"> <ComboBoxItem>时</ComboBoxItem> <ComboBoxItem>天</ComboBoxItem> <ComboBoxItem>每周</ComboBoxItem> </ComboBox> </Grid>
后台代码
txtConTxsx.SetValue(Grid.ColumnProperty, 2);//设置到Grid对应列 cb_unit_txsx.SetValue(Grid.ColumnProperty, 1);//设置到Grid对应列