开发者

Writing layer to a class?

开发者 https://www.devze.com 2023-03-04 23:28 出处:网络
I have a Class that contains: A DataGrid, A Pager I am trying to make User Control that contains both of them and have all property that links to both of them.

I have a Class that contains: A DataGrid, A Pager

I am trying to make User Control that contains both of them and have all property that links to both of them.

So something:

public class MyGridViewPager : ltcGrid
    {
        public GridView aGridView;
        public DataPager aDataPager;
        public bool AutoGenerateColumns { 
           get { return this.aGridView.AutoGenerateColumns; } 
           set { this.aGridView.AutoGenerateColumns = value; } }

}

So I can use the property from them in my MyGridViewPager UserControl and in case of any choice change on the GridView or DataPager I can modify only the layer...or is it called wrapper-class? Not so sure about the naming...

But... how do I do the same thing for EventHandler? I can see it defines in:

public delegate void Select开发者_开发技巧ionChangedEventHandler(object sender, SelectionChangedEventArgs e);

How can I expose this handler from my user control?

Note: I don't really want to do MyGridViewPager.aGridView.SelectionChangedEventArgs.


There is a myriad of ways to do this:

  • Exposing events of underlying control
  • Event Bubbling in C#
0

精彩评论

暂无评论...
验证码 换一张
取 消