Есть проблема с правильным выравниванием столбцов из listbox.datatemplate. grid!
Hi,
I'm new with WPF, just start learning, and have minor problem with column alignments.
One binding data "Attachment" is not able to show as column 2, but is under/over column 1, text is mixed with binding data "DateTimeMessage"?!
All other TextBlocks are fine.
Thanks in advance for help
What I have tried:
<code><ListBox x:Name="ListBoxMessages" Height="286" Margin="0,0,-65,0" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Visible" FontSize="14">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0">
<Run Text="{Binding Path=FullName}"/>
<Run Text="; "/>
</TextBlock>
<TextBlock Grid.Row="0" Grid.Column="1">
<Run Text="{Binding Path=DateTimeMessage, StringFormat=\{0:d.MMM.yyyy HH:mm:ss\}}" />
<Run Text="; "/>
</TextBlock>
<TextBlock Grid.Row="0" Grid.Column="2" Text="{Binding Path=Attachment}"/>
<TextBlock Text="{Binding Path=Message}" TextWrapping="Wrap" Grid.Row="1" Grid.Column="0" />
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox></code>