c# - Putting stack panels side by side -
c# - Putting stack panels side by side -
in xaml trying set 2 stack panels (in image) side side:
![enter image description here][1]
i trying utilize grid.row set 2 stack panels in same row, have not been successful.
below code:
 <grid>                         <grid.rowdefinitions>                             <rowdefinition></rowdefinition>                             <rowdefinition ></rowdefinition>                         </grid.rowdefinitions>                          <border borderbrush="black" borderthickness="1" width="auto" height="auto" margin="10,0,0,0">                         <stackpanel margin="10,5,279,0" name="connectupsstackpanel" >                             <label name="connectupslabel" height="28" verticalalignment="top" horizontalalignment="left" width="93">connect-ups</label>                                  <border borderbrush="black" borderthickness="1" height="235" grid.row="1" >                             <!--caution codes stack-->                                     <stackpanel horizontalalignment="left" margin="0,0,0,10" name="cautioncodestackpanel" height="auto" orientation="horizontal" grid.row="1">                                 <stackpanel name="cautioncodesreviewstackpanel" >                                     <groupbox header="caution codes" margin="0,0,0,0" horizontalalignment="left" width="137" borderthickness="2" height="217">                                         <scrollviewer verticalscrollbarvisibility="visible">                                             <grid name="grdcautioncodes" width="104" background="seashell" height="203"></grid>                                         </scrollviewer>                                     </groupbox>                                 </stackpanel>                              <stackpanel>                                     <button tooltip="create connect-up" margin="0,0,5,0" width="0.75 in" click="btncreateconnectup_click" horizontalalignment="left" height="72">                                         <textblock fontsize="18" textalignment="center">add</textblock>                                     </button>                                             <button tooltip="delete connect-up" margin="0,0,5,0" name="btndeleteconnectup1" width="0.75 in" fontsize="11" click="btnbtndeleteconnectup1_click" height="0.75 in" >                                         <textblock fontsize="18" textalignment="center">delete</textblock>                                     </button>                                             <button tooltip="delete connect-up" margin="0,0,5,0" name="btndeleteconnectup2" width="0.75 in" fontsize="11" click="btnbtndeleteconnectup2_click" height="0.75 in" f>                                                 <textblock fontsize="18" textalignment="center">delete</textblock>                                             </button>                                         </stackpanel>                             </stackpanel>                             </border>                                      <stackpanel margin="0,0,0,0" name="externalstackpanel" grid.row="1" orientation="horizontal">                                 <border borderbrush="black" borderthickness="1" height="226" margin="0,0,0,0" width="306">                                          <wrappanel margin="0,0,26,0" x:name="externalwrappanel">                                              <stackpanel margin="0,0,5,0" x:name="numberstackpanel" grid.column="1" >                                             <label horizontalalignment="left" margin="0,0,0,0"  x:name="eternallabel" verticalalignment="top" width="52" content="external"/>                                             <label horizontalalignment="left" x:name="poblabel" verticalalignment="top" content="number"/>                                             <textbox horizontalalignment="left" x:name="numtextbox1" height="23" width="130" text="{binding pob}" maxlength="30" />                                             <textbox horizontalalignment="left" margin="0,5,0,0" x:name="numtextbox2" height="23" width="130" text="{binding pob}" maxlength="30" />                                             <textbox horizontalalignment="left" margin="0,5,0,0" x:name="numtextbox3" height="23" width="130" text="{binding pob}" maxlength="30"  />                                             <textbox horizontalalignment="left" margin="0,5,0,0" x:name="numtextbox4" height="23" width="130" text="{binding pob}" maxlength="30"/>                                             <textbox horizontalalignment="left" margin="0,5,0,0" x:name="numtextbox5" height="23" width="130" text="{binding pob}" maxlength="30"/>                                             <textbox horizontalalignment="left" margin="0,5,0,0" x:name="numtextbox6" height="23" width="130" text="{binding pob}" maxlength="30" my:searchprops.searchtype="personplaceofbirth"/>                                          </stackpanel>                                         <stackpanel margin="5,25,0,0" x:name="personstackpanel" height="197">                                             <label x:name="personlabel" height="28" verticalalignment="top" horizontalalignment="left" width="58" content="person"/>                                             <telerik:combobox displaymemberpath="name" height="23" itemssource="{binding}" x:name="personycombobox1" />                                             <telerik:combobox margin="0,5,0,0" displaymemberpath="name" height="23" itemssource="{binding}" x:name="personcombobox2" />                                             <telerik:combobox margin="0,5,0,0" displaymemberpath="name" height="23" itemssource="{binding}" x:name="personcombobox3" />                                             <telerik:combobox margin="0,5,0,0" displaymemberpath="name" height="23" itemssource="{binding}" x:name="personcombobox4" />                                             <telerik:combobox margin="0,5,0,0" displaymemberpath="name" height="23" itemssource="{binding}" x:name="personcombobox5" />                                             <telerik:combobox margin="0,5,0,0" displaymemberpath="name" height="23" itemssource="{binding}" x:name="personcombobox6" />                                          </stackpanel>                                        </wrappanel>                                  </border>                             </stackpanel>                          </stackpanel>                     </border>                      </grid>       
you can create new stack panel orientation property set "horizontal", set panel in sec row of grid , set both of stack panels within of it.
basically:
<stackpanel grid.row="2" orientation="horizontal">    <yourfirststackpanel/>    <yoursecondstackpanel/> </stackpanel>    the other solution can implement, create 2 columns in grid , set stack panels on same row 1 on column 0 , other in column one.
example:
<grid>   <grid.columndefinitions>     <columndefinition/>     <columndefinition/>   </grid.columndefinitions>    <grid.rowdefinitions>     <rowdefinition/>   </grid.rowdefinitions>    <stackpanel grid.row="0" grid.column="0">...</stackpanel>   <stackpanel grid.row="0" grid.column="1">...</stackpanel> </grid>        c# wpf xaml 
 
Comments
Post a Comment