當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。