@@ -146,22 +146,22 @@ protected override Visual GetVisualChild(int index)
146146
147147 public partial class LayoutViewer : UserControl
148148 {
149- private enum DisplayAlignmentType
149+ public enum DisplayAlignmentType
150150 {
151- Struct ,
151+ Struct = 0 ,
152152 Cacheline ,
153153 Custom
154154 }
155155
156156 public enum DisplayMode
157157 {
158- Stack ,
158+ Stack = 0 ,
159159 Flat
160160 }
161161
162162 public enum GridBase
163163 {
164- Decimal ,
164+ Decimal = 0 ,
165165 Hexadecimal ,
166166 }
167167
@@ -179,6 +179,10 @@ public enum GridBase
179179 const double MarginBottom = 25 ;
180180 const double paddingSize = 5 ;
181181
182+ public static DisplayAlignmentType DefaultDisplayAlignment { set ; get ; } = DisplayAlignmentType . Struct ;
183+ public static DisplayMode DefaultDisplayMode { set ; get ; } = DisplayMode . Stack ;
184+ public static GridBase DefaultGridNumberBase { set ; get ; } = GridBase . Hexadecimal ;
185+
182186 private Typeface Font = new Typeface ( "Verdana" ) ;
183187 private Pen gridPen = new Pen ( new SolidColorBrush ( Color . FromArgb ( 100 , 0 , 0 , 0 ) ) , 1 ) ;
184188
@@ -208,19 +212,23 @@ public enum GridBase
208212
209213 public LayoutViewer ( )
210214 {
215+ ThreadHelper . ThrowIfNotOnUIThread ( ) ;
216+
211217 InitializeComponent ( ) ;
212218 this . DataContext = this ;
213219
214220 overlayBrush . Opacity = 0.3 ;
215221 SetDisplayGridColumns ( 8 ) ;
216222
223+ GridNumberBase = DefaultGridNumberBase ;
224+
217225 tooltipTimer . Tick += ShowTooltip ;
218226
219227 displayAlignementComboBox . ItemsSource = Enum . GetValues ( typeof ( DisplayAlignmentType ) ) . Cast < DisplayAlignmentType > ( ) ;
220- displayAlignementComboBox . SelectedIndex = 0 ;
228+ displayAlignementComboBox . SelectedIndex = ( int ) DefaultDisplayAlignment ;
221229
222230 displayModeComboBox . ItemsSource = Enum . GetValues ( typeof ( DisplayMode ) ) . Cast < DisplayMode > ( ) ;
223- displayModeComboBox . SelectedIndex = 0 ;
231+ displayModeComboBox . SelectedIndex = ( int ) DefaultDisplayMode ;
224232
225233 scrollViewer . Loaded += ScrollViewer_OnLoaded ;
226234 scrollViewer . On2DMouseScroll += ScrollViewer_On2DMouseScroll ;
@@ -248,11 +256,11 @@ public void SetLayout(LayoutNode root)
248256 }
249257 }
250258
251- public void SetGridNumberBase ( GridBase newBase )
259+ public void RefreshDefaults ( )
252260 {
253- if ( newBase != GridNumberBase )
261+ if ( DefaultGridNumberBase != GridNumberBase )
254262 {
255- GridNumberBase = newBase ;
263+ GridNumberBase = DefaultGridNumberBase ;
256264
257265 RenderGrid ( ) ;
258266 RefreshShapes ( ) ;
0 commit comments