问题描述
您好是有可能有一个ListView - > ListView.View - > GridView控件 - > GridViewColumn每行两行。
结果
例如。
结果
           第1列|第2列结果
第1行等等           |数据结果            等等
结果第2行等           |更多
Hello is it possible to have a ListView -> ListView.View -> GridView -> GridViewColumn with "two rows" per row.
eg.
COLUMN 1 | COLUMN 2
ROW 1 blah | data
blah
ROW 2 etc | more
我曾尝试不成功使用的模板中的单元格模板,但该项目不调整时,其载列手动调整。
I have tried unsuccessfully to use a Cell template but the item inside the template doesn't resize when its containing column is manually resized.
code:
<ListView Height="238" DockPanel.Dock="Top" ItemsSource="{Binding Blah}"
SelectedItem="{Binding Path=Selectedblah, UpdateSourceTrigger=PropertyChanged}">
<ListView.View>
<GridView>
<GridViewColumn Header="No." DisplayMemberBinding="{Binding Path=Id}" Width="25" />
<GridViewColumn Header="Job Type" DisplayMemberBinding="{Binding Path=Something}" Width="165" />
<GridViewColumn Header="Assigned To" DisplayMemberBinding="{Binding Path=SomethingElse}" Width="90" />
<GridViewColumn Header="Created" DisplayMemberBinding="{Binding Path=DateCreated, Converter={StaticResource dateTimeFormat}, ConverterParameter='dd/MM/yy HH:mm'}" Width="65" />
<GridViewColumn>
<GridViewColumn.CellTemplate>
<DataTemplate>
<Image Source="/Streetcar.UI.Modules.FleetTracker;component/Resources/Images/tick.png" Visibility="{Binding IsCompleted, Converter={StaticResource boolToVis}}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
任何想法?
编辑:所以仅仅落后一界视图模型
推荐答案
好吧,我再试一次。你有没有试过 CellTemplate
与的TextBlock
与 TextWrapping
集到裹
?
Okay, I'll try again. Have you tried a CellTemplate
with a TextBlock
with TextWrapping
set to Wrap
?
例如:
<ListView x:Name="MyListView">
<ListView.View>
<GridView>
<GridViewColumn Header="Hello"
Width="50">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce non nibh quis odio aliquet venenatis."
TextWrapping="Wrap"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="World"/>
</GridView>
</ListView.View>
<ListViewItem/>
<ListViewItem/>
<ListViewItem/>
<ListViewItem/>
</ListView>
这篇关于WPF - GridView.GridViewColumn每行两行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!