3

I'm using Yet Another TabControl in my project - it's custom, open sourced TabControl with support for designer. After solving some of its problems, I've stumbled upon a problem I have no clue how to solve.

When I run my application, YATabControl would select the same tab I selected in designer - which is not exactly what I want (I'd rather start with first tab) and I can't move through the tabs while application is running, because it tries to save property "SelectedIndex" on every change of tab.

It is set on designers ~onclick using:

RaiseComponentChanging( TypeDescriptor.GetProperties( Control )[ "SelectedIndex" ] );  
RaiseComponentChanged( TypeDescriptor.GetProperties( Control )[ "SelectedIndex" ], oi, i );(old index, index).

I'm thinking - is there a way to disable designer from setting runtime value of property?

4

2 に答える 2

5

ソース コードを確認しました (ダウンロードしませんでした) が、それSelectedIndex自体をシリアル化しないようにプロパティに指示する必要があるようです。

[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public virtual int SelectedIndex {
  get {
    return yaSelectedIndex;
  }
  set {...}
}
于 2012-08-24T12:38:51.983 に答える
3

[Browseable(false)]行く方法です:)

于 2012-08-24T12:40:04.347 に答える