我有一个 GridView 列:
public class SortableGridViewColumn : GridViewColumn
{
public string SortPropertyName
{
get { return (string)GetValue(SortPropertyNameProperty); }
set { SetValue(SortPropertyNameProperty, value); }
}
public static readonly DependencyProperty SortPropertyNameProperty =
DependencyProperty.Register("SortPropertyName", typeof(string),
typeof(SortableGridViewColumn), new UIPropertyMetadata(""));
}
和一个 GridViewColumnHeader 模板
<GridView.ColumnHeaderContainerStyle>
<Style TargetType="GridViewColumnHeader">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GridViewColumnHeader}">
<Border cal:Message.Attach="[Event MouseLeftButtonDown]
= [Action Sort($source.TemplatedParent)]">
<ContentPresenter Margin="2,2,2,2" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style></GridView.ColumnHeaderContainerStyle>
而不是$source.TemplatedParent
我想以某种方式将 SortPropertyName 作为参数传递。
有谁知道我怎么能做到这一点?
感谢您的帮助,如果我问的不正确,我很抱歉 - 这是我在这里的第一个问题。