本文整理汇总了C#中System.Windows.Controls.ListView.AddHandler方法的典型用法代码示例。如果您正苦于以下问题:C# ListView.AddHandler方法的具体用法?C# ListView.AddHandler怎么用?C# ListView.AddHandler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.ListView
的用法示例。
在下文中一共展示了ListView.AddHandler方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RegisterSortableGridview
/// <summary>
/// Registers a ListView to allow sorting
/// </summary>
private static void RegisterSortableGridview(ListView grid,
DependencyPropertyChangedEventArgs args)
{
if (args.NewValue is Boolean && (Boolean)args.NewValue)
{
grid.AddHandler(GridViewColumnHeader.ClickEvent,
GridViewColumnHeaderClickHandler);
}
else
{
grid.RemoveHandler(GridViewColumnHeader.ClickEvent,
GridViewColumnHeaderClickHandler);
}
}
示例2: RegisterSortableGridView
private static void RegisterSortableGridView(ListView grid,
DependencyPropertyChangedEventArgs args)
{
if (args.NewValue is Boolean && (Boolean)args.NewValue)
{
grid.AddHandler(ButtonBase.ClickEvent,
new RoutedEventHandler(GridViewColumnHeaderClickedHandler));
}
else
{
grid.AddHandler(ButtonBase.ClickEvent,
new RoutedEventHandler(GridViewColumnHeaderClickedHandler));
}
}
示例3: createOverviewPanel
//creates the overview of the fleet
private StackPanel createOverviewPanel()
{
StackPanel panelOverview = new StackPanel();
TextBlock txtFleetBoughtHeader = new TextBlock();
txtFleetBoughtHeader.Uid = "1003";
txtFleetBoughtHeader.Margin = new Thickness(0, 0, 0, 0);
txtFleetBoughtHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
txtFleetBoughtHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2");
txtFleetBoughtHeader.FontWeight = FontWeights.Bold;
txtFleetBoughtHeader.Text = Translator.GetInstance().GetString("PageAirlineFleet", txtFleetBoughtHeader.Uid);
panelOverview.Children.Add(txtFleetBoughtHeader);
lvBoughtFleet = new ListView();
lvBoughtFleet.Background = Brushes.Transparent;
lvBoughtFleet.SetResourceReference(ListView.ItemContainerStyleProperty, "ListViewItemStyle");
lvBoughtFleet.MaxHeight = (GraphicsHelpers.GetContentHeight()-100) / 2;
lvBoughtFleet.AddHandler(GridViewColumnHeader.ClickEvent, new RoutedEventHandler(FleetHeaderClickedHandler), true);
lvBoughtFleet.BorderThickness = new Thickness(0);
lvBoughtFleet.View = this.Resources["FleetViewBoughtItem"] as GridView;
panelOverview.Children.Add(lvBoughtFleet);
lvBoughtFleet.ItemsSource = this.FleetDelivered.Where(f=>f.Purchased == FleetAirliner.PurchasedType.Bought || f.Purchased == FleetAirliner.PurchasedType.BoughtDownPayment);
TextBlock txtFleetLeasedHeader = new TextBlock();
txtFleetLeasedHeader.Uid = "1012";
txtFleetLeasedHeader.Margin = new Thickness(0, 5, 0, 0);
txtFleetLeasedHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
txtFleetLeasedHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2");
txtFleetLeasedHeader.FontWeight = FontWeights.Bold;
txtFleetLeasedHeader.Text = Translator.GetInstance().GetString("PageAirlineFleet", txtFleetLeasedHeader.Uid);
panelOverview.Children.Add(txtFleetLeasedHeader);
lvLeasedFleet = new ListView();
lvLeasedFleet.Background = Brushes.Transparent;
lvLeasedFleet.SetResourceReference(ListView.ItemContainerStyleProperty, "ListViewItemStyle");
lvLeasedFleet.MaxHeight = (GraphicsHelpers.GetContentHeight()-100) / 2;
lvLeasedFleet.AddHandler(GridViewColumnHeader.ClickEvent, new RoutedEventHandler(FleetHeaderClickedHandler), true);
lvLeasedFleet.View = this.Resources["FleetViewLeasedItem"] as GridView;
panelOverview.Children.Add(lvLeasedFleet);
lvLeasedFleet.ItemsSource = this.FleetDelivered.Where(f => f.Purchased == FleetAirliner.PurchasedType.Leased);
return panelOverview;
}