当前位置: 首页>>代码示例>>C#>>正文


C# ListView.AddHandler方法代码示例

本文整理汇总了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);
     }
 }
开发者ID:ssickles,项目名称:archive,代码行数:17,代码来源:SortableListBehaviour.cs

示例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));
     }
 }
开发者ID:neapolis,项目名称:SambaPOS-3,代码行数:14,代码来源:ListViewSorter.cs

示例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;
        }
开发者ID:rhgtvcx,项目名称:tap-desktop,代码行数:50,代码来源:PageAirlineFleet.xaml.cs


注:本文中的System.Windows.Controls.ListView.AddHandler方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。