Questions tagged «wpftoolkit»

3
如何在WPF工具包DataGrid上对DataGridTemplateColumn进行排序?
我有一个带有一个DataGridTemplateColumn的WPF Toolkit DataGrid。我已经在grid属性中指定了我希望所有列都是可排序的,但是DataGridTemplateColumn不允许这样做。所有其他列均允许排序。我什至尝试将该列的CanUserSort显式设置为true,但是没有运气。甚至可以对模板列进行排序吗?我提供了适用于所有列的自定义排序器,但标题不允许单击排序。 <Controls:DataGrid ItemsSource="{Binding Events}" AutoGenerateColumns="False" CanUserSortColumns="True" CanUserReorderColumns="False" Sorting="DataGrid_Sorting" x:Name="EventsGrid"> <Controls:DataGrid.Columns> <Controls:DataGridTemplateColumn Header="Type" Width="42" CanUserResize="False"> <Controls:DataGridTemplateColumn.CellTemplate> <DataTemplate> <Image Source="{Binding EventTypeImage, Mode=OneWay}" HorizontalAlignment="Center" Width="16"/> </DataTemplate> </Controls:DataGridTemplateColumn.CellTemplate> </Controls:DataGridTemplateColumn> <Controls:DataGridTextColumn Header="Source" Binding="{Binding Source, Mode=OneWay}" /> <Controls:DataGridTextColumn Header="Details" MinWidth="175" Binding="{Binding Details, Mode=OneWay}" /> <Controls:DataGridTextColumn Header="Timestamp" MinWidth="175" Binding="{Binding Timestamp, Mode=OneWay}" IsReadOnly="True"/> </Controls:DataGrid.Columns> </Controls:DataGrid>

5
标签内容上的WPF StringFormat
我想将字符串绑定的格式设置为绑定到标签的属性Amount is X所在的位置X。 我看过很多示例,但以下示例不起作用: <Label Content="{Binding Path=MaxLevelofInvestment, StringFormat='Amount is {0}'}" /> 我也尝试过这些组合: StringFormat=Amount is {0} StringFormat='Amount is {}{0}' StringFormat='Amount is \{0\}' 我甚至试图改变绑定属性的数据类型来int,string和double。似乎没有任何作用。这是一个非常常见的用例,但似乎不受支持。
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.