2016-12-06 79 views
0

調整界面大小時,界面上的單選按鈕會移動。我想知道如何防止這種情況。我認爲設置水平和垂直對齊是足夠的,但它不起作用。有任何想法嗎? Before resizeafter resize調整窗口大小時單選按鈕移動

下面是代碼到我的網格:

<Grid Margin="20,3,10,-10"> 
         <Grid.ColumnDefinitions> 
          <ColumnDefinition Width="105"/> 
          <ColumnDefinition Width="255"/> 
          <ColumnDefinition Width="23"/> 
          <ColumnDefinition Width="98"/> 
          <ColumnDefinition Width="20"/> 
          <ColumnDefinition Width="240"/> 
          <ColumnDefinition Width="20"/> 
          <ColumnDefinition Width="114"/> 
          <ColumnDefinition Width="20*"/> 
          <ColumnDefinition Width="273*"/> 
         </Grid.ColumnDefinitions> 
         <Grid.RowDefinitions> 
          <RowDefinition Height="30"/> 
          <RowDefinition Height="30"/> 
          <RowDefinition Height="30"/> 
          <RowDefinition Height="30"/> 
          <RowDefinition Height="30"/> 
          <RowDefinition Height="30"/> 
          <RowDefinition Height="120"/> 
          <RowDefinition/> 
         </Grid.RowDefinitions> 

         <!--ROW 0--> 
         <!--COLUMN 0 & 1--> 
         <TextBlock Text="Customer" Grid.Row="0" FontWeight="Bold" Margin="0,7" Height="16" Width="54"/> 
         <dxe:ButtonEdit Name="xbteCustomer" Grid.Row="0" Grid.Column="1" AllowDefaultButton="False" NullTextForeground="Black" LostFocus="xcbeControl_LostFocus" 
             KeyDown="xcbeControl_KeyDown" Margin="6,5,21,0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderThickness="1" BorderBrush="#D6D6D6" 
             NullText="Select" EditValueChanged="xcbeEvent_EditValueChanged" TabIndex="1" Grid.ColumnSpan="2"> 
          <dxe:ButtonEdit.Buttons> 
           <dxe:ButtonInfo x:Name="xbteSearchCustomer" Content="Search" GlyphKind="Search" Click="xbteFilter_Click"/> 
          </dxe:ButtonEdit.Buttons> 
         </dxe:ButtonEdit> 
         <!--<dxg:LookUpEdit x:Name="xcbeCustomerId" Grid.Row="0" FilterCondition="Contains" Grid.Column="1" EditValueChanging="Event_EditValueChanging" HorizontalAlignment="Left" VerticalAlignment="Stretch" 
       DisplayMember="CustomerName" ValueMember="CustomerId" Margin="5,5,0,0" Width="250" PopupOpening="xcbeCustomerId_PopupOpening"> 
          <dxg:LookUpEdit.PopupContentTemplate> 
           <ControlTemplate> 
            <dxg:GridControl x:Name="PART_GridControl" Loaded="PART_GridControl_Loaded"> 
             <dxg:GridControl.Columns> 
              <dxg:GridColumn x:Name="xgcCustomerId" FieldName="CustomerId" Visible="False"/> 
              <dxg:GridColumn x:Name="xgcCustomerCode" FieldName="CustomerCode" Header="Code" Width="100"/> 
              <dxg:GridColumn x:Name="xgcCustomerName" FieldName="CustomerName" Header="Name"/> 
             </dxg:GridControl.Columns> 
             <dxg:GridControl.View> 
              <dxg:TableView AutoWidth="True" AllowBestFit="True"/> 
             </dxg:GridControl.View> 
            </dxg:GridControl> 
           </ControlTemplate> 
          </dxg:LookUpEdit.PopupContentTemplate> 
         </dxg:LookUpEdit>--> 
         <!--COLUMN 3 & 4--> 
         <TextBlock Text="Account Code" Grid.Row="0" Grid.Column="3" VerticalAlignment="Center" FontWeight="Bold" Margin="3,7,0,7" Height="16" Width="79"/> 
         <dxe:TextEdit x:Name="xtxtAccountCode" Grid.Row="0" Grid.Column="5" EditValueChanging="Event_EditValueChanging" HorizontalAlignment="Left" 
       VerticalAlignment="Stretch" Width="150" Margin="0,5,0,0" MaxLength="10" /> 

         <!--ROW 1--> 
         <!--COLUMN 0 & 1--> 
         <TextBlock Text="Account Name" Grid.Row="1" VerticalAlignment="Center" FontWeight="Bold" Margin="0,7" Height="16" Width="83"/> 
         <dxe:TextEdit x:Name="xtxtAccountName" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" 
       EditValueChanging="Event_EditValueChanging" Margin="6,5,21,0" Grid.ColumnSpan="2" /> 
         <!--COLUMN 3 & 4--> 
         <TextBlock Text="Credit Limit" Grid.Row="1" VerticalAlignment="Center" Grid.Column="3" FontWeight="Bold" Margin="3,7,0,7" Height="16" Width="66"/> 
         <dxe:TextEdit x:Name="xtxtCreditLimit" Grid.Row="1" Grid.Column="5" EditValueChanging="Event_EditValueChanging" VerticalAlignment="Stretch" 
       Width="150" DisplayFormatString="c" MaskType="RegEx" Mask="(\d+(.\d){0,0})+" Margin="0,5,0,0"/> 

         <TextBlock Text="Default OU" FontWeight="Bold" Grid.Row="2" Grid.Column="3" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="3,7,0,7" Height="16" Width="63"/> 
         <dxe:ComboBoxEdit x:Name="xcbeDefaultOUId" DisplayMember="Value" ValueMember="Key" Grid.Row="2" Grid.Column="5" NullTextForeground="Black" HorizontalAlignment="Left" NullText="Select" Width="150" 
              VerticalAlignment="Stretch" Margin="0,5,0,0" 
              EditValueChanging="Event_EditValueChanging"/> 

         <!--ROW 2--> 
         <!--COLUMN 0 & 1--> 
         <TextBlock Text="Sales Team" Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" FontWeight="Bold" Margin="0,7" Height="16" Width="62"/> 
         <dxg:LookUpEdit x:Name="xcbeSalesTeamId" FilterCondition="Contains" Grid.Row="2" Grid.Column="1" EditValueChanging="Event_EditValueChanging" HorizontalAlignment="Left" 
       DisplayMember="TeamName" ValueMember="SalesTeamId" Width="150" Margin="6,5,0,0" VerticalAlignment="Top" Height="25"> 
          <dxg:LookUpEdit.PopupContentTemplate> 
           <ControlTemplate> 
            <dxg:GridControl x:Name="PART_GridControl" Loaded="PART_GridControl_Loaded"> 
             <dxg:GridControl.Columns> 
              <dxg:GridColumn x:Name="xgcSalesTeamId" FieldName="SalesTeamId" Visible="False"/> 
              <dxg:GridColumn x:Name="xgcTeamCode" FieldName="TeamCode" Header="Code" Width="100"/> 
              <dxg:GridColumn x:Name="xgcTeamName" FieldName="TeamName" Header="Name"/> 
             </dxg:GridControl.Columns> 
             <dxg:GridControl.View> 
              <dxg:TableView AutoWidth="True" AllowBestFit="True"/> 
             </dxg:GridControl.View> 
            </dxg:GridControl> 
           </ControlTemplate> 
          </dxg:LookUpEdit.PopupContentTemplate> 
         </dxg:LookUpEdit> 

         <!--COLUMN 3 & 4--> 
         <TextBlock Text="UOM" Grid.Row="3" Grid.Column="3" FontWeight="Bold" Height="16" Margin="3,7,0,7" Width="86"/> 
         <dxe:ComboBoxEdit x:Name="xcbeUOM" Grid.Row="3" Grid.Column="5" HorizontalAlignment="Left" Width="150" VerticalAlignment="Stretch" NullText="Select" NullTextForeground="Black" 
             Margin="0,5,0,0" DisplayMember="Value" ValueMember="Key" 
          EditValueChanging="Event_EditValueChanging" EditValueChanged="xcbeUOM_EditValueChanged"/> 

         <TextBlock Text="UOM Conversion" Grid.Row="4" Grid.Column="3" FontWeight="Bold" Height="16" Margin="3,7,0,7" Width="95" /> 
         <dxg:LookUpEdit x:Name="xlueUOMConversion" Grid.Row="4" Grid.Column="5" VerticalAlignment="Top" EditValueChanging="Event_EditValueChanging" 
             DisplayMember="Conversiontxt" AutoPopulateColumns="False" ValueMember="UOMConversionId" Margin="0,5,0,0" Height="25" NullText="Select" NullTextForeground="Black"> 
          <dxg:LookUpEdit.PopupContentTemplate> 
           <ControlTemplate> 
            <dxg:GridControl x:Name="PART_GridControl"> 
             <dxg:GridControl.Columns> 
              <dxg:GridColumn x:Name="xgcConversionID" FieldName="UOMconversionId" Header="Id" Visible="False"/> 
              <dxg:GridColumn x:Name="xgcConversiontxt" FieldName="Conversiontxt" Header="Conversion" Width="120"/> 
              <dxg:GridColumn x:Name="xgcConversion" FieldName="Conversion" Header="Conversion Rate" Width="70"/> 
             </dxg:GridControl.Columns> 
             <dxg:GridControl.View> 
              <dxg:TableView AutoWidth="True" /> 
             </dxg:GridControl.View> 
            </dxg:GridControl> 
           </ControlTemplate> 
          </dxg:LookUpEdit.PopupContentTemplate> 
         </dxg:LookUpEdit> 



         <TextBlock Text="Split Freight"  Grid.Row="0" Grid.Column="7" FontWeight="Bold" Height="16" Margin="0,7" Width="70" /> 
         <RadioButton Name="xrbtSplitFreight" Content="" Grid.Row="0" Grid.Column="9" VerticalAlignment="Center" Checked="xrbtButton_Checked" FlowDirection="LeftToRight" FontWeight="Bold" HorizontalAlignment="Left" Width="18"/> 

         <TextBlock Text="Print Comment"  Grid.Row="1" Grid.Column="7" FontWeight="Bold" Height="16" Margin="0,7" Width="114" /> 
         <RadioButton Name="xrbtPrintComment" Grid.Row="1" Grid.Column="9" Checked="xrbtButton_Checked" VerticalAlignment="Center" FontWeight="Bold" HorizontalAlignment="Left" Width="18" /> 

         <TextBlock Text="Do Not Split Freight"  Grid.Row="2" Grid.Column="7" FontWeight="Bold" Height="16" Margin="0,7" Width="114" /> 
         <RadioButton Name="xrbtDonotSplitFreight" Grid.Row="2" Grid.Column="9" HorizontalAlignment="Left" VerticalAlignment="Center" Checked="xrbtButton_Checked" FontWeight="Bold" Width="18"/> 

         <!--ROW 3--> 
         <!--COLUMN 0 & 1--> 
         <TextBlock Text="Sales Rep" Grid.Row="3" Grid.Column="0" VerticalAlignment="Center" FontWeight="Bold" Margin="0,7" Height="16" Width="53"/> 
         <dxg:LookUpEdit x:Name="xcbeSalesRepId" FilterCondition="Contains" Grid.Row="3" Grid.Column="1" EditValueChanging="Event_EditValueChanging" HorizontalAlignment="Left" 
       DisplayMember="FullName" ValueMember="SalesRepId" Width="150" Margin="6,5,0,0" VerticalAlignment="Stretch"> 
          <dxg:LookUpEdit.PopupContentTemplate> 
           <ControlTemplate> 
            <dxg:GridControl x:Name="PART_GridControl" Loaded="PART_GridControl_Loaded" ScrollViewer.VerticalScrollBarVisibility="Auto" 
          ScrollViewer.HorizontalScrollBarVisibility="Auto"> 
             <dxg:GridControl.Columns> 
              <dxg:GridColumn x:Name="xgcSalesRepId" FieldName="SalesRepId" Visible="False"/> 
              <dxg:GridColumn x:Name="xgcCode" FieldName="Code" Header="Code" Width="100" /> 
              <dxg:GridColumn x:Name="xgcPerson" FieldName="FullName" Header="Full Name" Width="Auto" /> 
             </dxg:GridControl.Columns> 
             <dxg:GridControl.View> 
              <dxg:TableView AllowBestFit="True"/> 
             </dxg:GridControl.View> 
            </dxg:GridControl> 
           </ControlTemplate> 
          </dxg:LookUpEdit.PopupContentTemplate> 
         </dxg:LookUpEdit> 

         <!--ROW 4--> 
         <!--COLUMN 0 & 1--> 
         <TextBlock Text="Status" Grid.Row="4" Grid.Column="0" VerticalAlignment="Center" FontWeight="Bold" Margin="0,7" Height="16" Width="35"/> 
         <dxe:ComboBoxEdit x:Name="xcbeCustomerStatusId" Grid.Row="4" DisplayMember="Value" ValueMember="Key" Grid.Column="1" HorizontalAlignment="Left" Width="150" VerticalAlignment="Stretch" Margin="6,5,0,0" 
       EditValueChanging="Event_EditValueChanging"/> 

         <!--ROW 5--> 
         <!--COLUMN 0 & 1--> 
         <TextBlock Text="Payment Term" Grid.Row="5" VerticalAlignment="Center" Grid.Column="0" FontWeight="Bold" Margin="0,7" Height="16" Width="81"/> 
         <dxe:ComboBoxEdit x:Name="xcbeCustomerTermId" Grid.Row="5" Grid.Column="1" DisplayMember="Value" ValueMember="Key" HorizontalAlignment="Left" Width="150" VerticalAlignment="Stretch" Margin="6,5,0,0" 
       EditValueChanging="Event_EditValueChanging"/> 
         <!--row 6--> 

         <TextBlock Text="Comment"   Grid.Row="6" Grid.Column="0" FontWeight="Bold" VerticalAlignment="Top" Margin="0,5,0,0" Height="16" Width="55"/> 
         <dxe:TextEdit x:Name="xtxtNote"  Grid.Row="6" Grid.Column="1" Grid.ColumnSpan="7" EditValueChanging="Event_EditValueChanging" TextWrapping="Wrap" VerticalContentAlignment="Top" 
          ScrollViewer.VerticalScrollBarVisibility="Auto" Margin="6,5,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" /> 
         <!--radio button--> 
         <!--<dxe:ListBoxEdit Name="xrbSplitFreight" Grid.Row="0" Grid.RowSpan="7" FontWeight="Bold" Grid.Column="8" Height="90" VerticalAlignment="center" Width="174" HorizontalAlignment="Left" Grid.ColumnSpan="3" ShowBorder="False"> 
          <dxe:ListBoxEdit.StyleSettings> 
           <dxe:RadioListBoxEditStyleSettings /> 
          </dxe:ListBoxEdit.StyleSettings> 
         </dxe:ListBoxEdit>--> 
        </Grid> 
+2

你能提供你的網格代碼嗎?我敢打賭它是autosize或什麼 - 與你的按鈕本身無關。 – TripleEEE

+0

剛剛編輯帖子 – RickS

+0

你可以添加移動單選按鈕的屏幕截圖嗎? – Prajwal

回答

1

,因爲你定義你最後一個(具有索引9日列)作爲 "20*"/

這會讓你的第9個欄成長一樣10列("273*") - 當它生長的RadioButtons向右移動,因爲它們是在第10列,它會從第9列推成長:)

+0

感謝這工作! – RickS

+1

不客氣;)佈局管理器可怕;) – TripleEEE

相關問題