Имея следующий код МОФ:[WPF] Как установить ширину и высоту сетки, которая находится в шаблоне данных
<Window x:Class="WpfApplication5.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:c="clr-namespace:WpfApplication5"
Title="Window1" Height="300" Width="300">
<Window.Resources>
<c:Places x:Key="PlacesData"/>
<DataTemplate x:Key="DataTemplate" DataType="{x:Type c:Place}">
<Grid HorizontalAlignment="Left"
>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="40"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="{Binding Name}"/>
<TextBlock Grid.Column="1" Text="{Binding State}" TextAlignment="Right"/>
</Grid>
</DataTemplate>
</Window.Resources>
<Grid>
<ListBox ItemsSource="{Binding Source={StaticResource PlacesData}}"
ItemTemplate="{StaticResource DataTemplate}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.CanContentScroll="False"
HorizontalContentAlignment="Stretch"/>
</Grid>
Выход на этот alt text http://img51.imageshack.us/img51/3977/listboxscreenshot.jpg
Я хочу чтобы код состояния отображался всегда в правой части списка, и это должно произойти и при изменении размера окна.
Любые идеи?
Я не работаю. Та же проблема – Alin