c# - How to display in a StackPanel the TextBlock vertically and horizontally? -


I have a list view with some elements. For each item, I get an image, object name and properties Join one.

I have set the horizontal orientation of the stackpanel.

Shows the image on the left, but the name of the correct object is named.

I wanted to display property under the name, how should I always do the right side of the image, if the stackpayel I set it horizontally?

  & lt; StackPanel Orientation = "Horizontal" & gt; & Lt; Image Source = "property / rsz_1rsz_museumiclip.jpg" /> & Lt; Text block text = "" /> & Lt; TextBlock Text = "{Binding Path = NomeMuseo}" FontSize = "26" /> & Lt; Text block text = "{binding path = pies}" /> gt; // This IS & lt; / StackPanel & gt;    

Since dockpanel is not an option, I just Grid will let you control the layout of that type properly:

  & lt; Grid & gt; & Lt; Grid.RowDefinitions & gt; & Lt; RowDefinition Width = "Auto" /> & Lt; RowDefinition Width = "Auto" /> & Lt; /Grid.RowDefinitions> & Lt; Grid.ColumnDefinitions & gt; & Lt; Column define height = "auto" /> & Lt; Column define height = "20" /> & Lt; /Grid.ColumnDefinitions> & Lt; Image Source = "property / rsz_1rsz_museumiclip.jpg" /> & Lt; Text block text = "" /> & Lt; TextBlock Text = "{Binding Path = NomeMuseo}" FontSize = "26" Grid. Line = "0" grid Column = "1" /> & Lt; TextBlock Text = "{Binding Path = Paese}" Grid Line = "1" grid. Column = "1" /> & Lt; / Grid & gt;  

Alternatively, ChrisW has suggested that you can use two stackpellers . It's a bit easier to set up, but you lose some control.

  & lt; StackPanel Orientation = "Horizontal" & gt; & Lt; Image Source = "property / rsz_1rsz_museumiclip.jpg" /> & Lt; StackPanel & gt; & Lt; TextBlock Text = "{Binding Path = NomeMuseo}" FontSize = "26" /> & Lt; TextBlock Text = "{Binding Path = Paese}" /> & Lt; / StackPanel & gt; & Lt; / StackPanel & gt;  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -