Note that there are some explanatory texts on larger screens.

plurals
  1. POLeft Alignement with wpf grid
    primarykey
    data
    text
    <p>In a WP7.5 application, i have a listbox containing a grid. This grid contain two row, and two columns (2x2)</p> <p>In grid, i display textbox, my problem is thar the alignement is bad ! I don't know why, i set horizontalAligement=true, but no change !</p> <p>Here is my code :</p> <pre><code>&lt;ListBox x:Name="ListBoxTiers" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0"&gt; &lt;ListBox.ItemTemplate&gt; &lt;DataTemplate&gt; &lt;StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch" VerticalAlignment="Top" &gt; &lt;Grid Margin="20" VerticalAlignment="Top" HorizontalAlignment="Left"&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition /&gt; &lt;RowDefinition /&gt; &lt;/Grid.RowDefinitions&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition /&gt; &lt;ColumnDefinition /&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Grid.Row="0" Grid.Column="0" Margin="0,0,10,0" x:Name="TxtBox_cCodeTiers" Text="{Binding m_strCode}" FontWeight="Bold" FontSize="22" /&gt; &lt;TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Grid.Row="0" Grid.Column="1" Margin="0,0,10,0" x:Name="TxtBox_cNomTiers" Text="{Binding m_strNom}" FontWeight="Bold" FontSize="22" /&gt; &lt;TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Grid.Row="1" Grid.ColumnSpan="2" Grid.Column="0" Margin="0,0,10,0" x:Name="TxtBox_cCPostal" Text="{Binding m_strFonction}" /&gt; &lt;/Grid&gt; &lt;/StackPanel&gt; &lt;/DataTemplate&gt; &lt;/ListBox.ItemTemplate&gt; </code></pre> <p></p> <p>Here is my result :</p> <p><img src="https://i.stack.imgur.com/2XIa1.png" alt="enter image description here"></p> <p>Here is my Class :</p> <pre><code>public class CTiers { public enum TypeTiers { Client, Fournisseur, Contact, Collaborateur, Commercial, Prospect}; TypeTiers m_TypeTiers { set; get; } public string m_strTypeTiers { get; set; } public string m_strCode { set; get; } public string m_strNom { set; get; } public string m_strPrenom { set; get; } public string m_strTel { set; get; } public string m_strGsm { set; get; } public string m_strFax { set; get; } public string m_strMail { set; get; } public string m_strWebSite { set; get; } public string m_strVille { set; get; } public string m_strCpostal { set; get; } public string m_strRue { set; get; } public string m_strFonction { set; get; } public CTiers() { } public CTiers(TypeTiers oTypeTiers, string strCode, string strNom, string strPrenom, string strTel, string strGsm, string strFax, string strRue,string strVille,string strCPostal,string strMail,string strWebSite,string strFonction) { m_TypeTiers = oTypeTiers; m_strCode = strCode.Trim(); m_strNom = strNom.Trim(); m_strPrenom = strPrenom.Trim(); m_strVille = strVille.Trim(); m_strTel = strTel.Trim(); m_strGsm = strGsm.Trim(); m_strFax = strFax.Trim(); m_strWebSite = strWebSite.Trim(); m_strRue = strRue.Trim(); m_strMail = strMail.Trim(); m_strCpostal = strCPostal.Trim(); m_strTypeTiers = oTypeTiers.ToString().Trim(); m_strFonction = strFonction.Trim(); } } </code></pre> <p>Anyone could help me please ? </p> <p>Thanks a lot :)</p> <p>Best regards</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload