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


C# ListView.SetModel方法代码示例

本文整理汇总了C#中ListView.SetModel方法的典型用法代码示例。如果您正苦于以下问题:C# ListView.SetModel方法的具体用法?C# ListView.SetModel怎么用?C# ListView.SetModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ListView的用法示例。


在下文中一共展示了ListView.SetModel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LiveRadioFilterView

        /// <summary>
        /// Constructor -- creates a Gtk Widget holding a genre choose box and a freetext query field
        /// </summary>
        public LiveRadioFilterView()
        {
            genre_view = new ListView<Genre> ();
            Column genre_column = new Column (new ColumnDescription ("Name", AddinManager.CurrentLocalizer.GetString ("Choose By Genre"), 100));
            genre_view.ColumnController = new ColumnController ();
            genre_view.ColumnController.Add (genre_column);
            List<Genre> stringlist = new List<Genre> ();
            stringlist.Add (new Genre(AddinManager.CurrentLocalizer.GetString ("Loading...")));
            genre_view.SetModel (new GenreListModel (stringlist));
            genre_view.Model.Selection.FocusChanged += OnViewGenreSelected;

            Label query_label = new Label (AddinManager.CurrentLocalizer.GetString ("Choose By Query"));
            HBox query_box = new HBox ();
            query_box.BorderWidth = 1;
            query_input = new Entry ();
            query_input.KeyReleaseEvent += OnInputKeyReleaseEvent;
            query_button = new Button (Stock.Find);
            query_button.Clicked += OnViewQuerySent;
            query_box.PackStart (query_input, true, true, 5);
            query_box.PackStart (query_button, false, true, 5);

            this.PackStart (SetupView (genre_view), true, true, 0);
            this.PackStart (query_label, false, true, 0);
            this.PackStart (query_box, false, true, 5);
        }
开发者ID:nailyk,项目名称:banshee-community-extensions,代码行数:28,代码来源:LiveRadioFilterView.cs

示例2: CreateLayout

        /// <summary>
        /// creates the layout of the widget
        /// </summary>
        /// <param name="plugins">
        /// A List<ILiveRadioPlugin> -- the plugin list
        /// </param>
        protected void CreateLayout(List<ILiveRadioPlugin> plugins)
        {
            plugin_view = new ListView<ILiveRadioPlugin> ();
            Column col_name = new Column (new ColumnDescription ("Name", AddinManager.CurrentLocalizer.GetString ("Plugin"), 100));
            Column col_version = new Column (new ColumnDescription ("Version", AddinManager.CurrentLocalizer.GetString ("Version"), 100));
            Column col_enabled = new Column (new ColumnDescription ("IsEnabled", AddinManager.CurrentLocalizer.GetString ("Enabled"), 100));
            plugin_view.ColumnController = new ColumnController ();
            plugin_view.ColumnController.Add (col_name);
            plugin_view.ColumnController.Add (col_version);
            plugin_view.ColumnController.Add (col_enabled);
            plugin_view.SetModel (new LiveRadioPluginListModel (plugins));
            plugin_view.Model.Selection.FocusChanged += OnPluginViewModelSelectionFocusChanged;;

            List<LiveRadioStatistic> stats = new List<LiveRadioStatistic> ();

            statistic_view = new ListView<LiveRadioStatistic> ();
            Column col_type = new Column (new ColumnDescription ("TypeName", AddinManager.CurrentLocalizer.GetString ("Type"), 100));
            Column col_origin = new Column (new ColumnDescription ("Origin", AddinManager.CurrentLocalizer.GetString ("Origin"), 100));
            Column col_short = new Column (new ColumnDescription ("ShortDescription", AddinManager.CurrentLocalizer.GetString ("Short Info"), 100));
            Column col_long = new Column (new ColumnDescription ("LongDescription", AddinManager.CurrentLocalizer.GetString ("Long Info"), 100));
            Column col_count = new Column (new ColumnDescription ("Count", AddinManager.CurrentLocalizer.GetString ("Count"), 100));
            Column col_average = new Column (new ColumnDescription ("Average", AddinManager.CurrentLocalizer.GetString ("Average"), 100));
            Column col_updates = new Column (new ColumnDescription ("Updates", AddinManager.CurrentLocalizer.GetString ("Updates"), 100));
            statistic_view.ColumnController = new ColumnController ();
            statistic_view.ColumnController.Add (col_type);
            statistic_view.ColumnController.Add (col_origin);
            statistic_view.ColumnController.Add (col_short);
            statistic_view.ColumnController.Add (col_long);
            statistic_view.ColumnController.Add (col_count);
            statistic_view.ColumnController.Add (col_average);
            statistic_view.ColumnController.Add (col_updates);
            statistic_view.SetModel (new LiveRadioStatisticListModel (stats));

            enable_button.TooltipText = AddinManager.CurrentLocalizer.GetString ("Enable Plugin");
            enable_button.Label = AddinManager.CurrentLocalizer.GetString ("Enable Plugin");
            enable_button.Sensitive = false;
            disable_button.TooltipText = AddinManager.CurrentLocalizer.GetString ("Disable Plugin");
            disable_button.Label = AddinManager.CurrentLocalizer.GetString ("Disable Plugin");
            disable_button.Sensitive = false;
            configure_button.TooltipText = AddinManager.CurrentLocalizer.GetString ("Configure Plugin");
            configure_button.Label = AddinManager.CurrentLocalizer.GetString ("Configure Plugin");
            configure_button.Sensitive = false;

            enable_button.Clicked += new EventHandler(OnEnableButtonClicked);
            disable_button.Clicked += new EventHandler (OnDisableButtonClicked);
            configure_button.Clicked += new EventHandler (OnConfigureButtonClicked);

            HBox button_box = new HBox ();
            button_box.PackStart (configure_button, false, false, 10);
            button_box.PackEnd (enable_button, false, false, 10);
            button_box.PackEnd (disable_button, false, false, 10);

            Label stat_label = new Label ();
            stat_label.UseMarkup = true;
            stat_label.Markup = "<b>" + AddinManager.CurrentLocalizer.GetString ("Plugin Statistics") + "</b>";

            Position = 275;

            VBox pack1 = new VBox ();
            VBox pack2 = new VBox ();

            pack1.PackStart (SetupView (plugin_view), true, true, 10);
            pack1.PackStart (button_box, false, true, 10);
            pack2.PackStart (stat_label, false, true, 20);
            pack2.PackStart (SetupView (statistic_view), true, true, 10);

            Pack1 (pack1, true, true);
            Pack2 (pack2, true, true);

            ShowAll ();
        }
开发者ID:nailyk,项目名称:banshee-community-extensions,代码行数:77,代码来源:LiveRadioSourceContents.cs


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