void determineStyle(double newWidth, IList<ResourceDictionary> resources) { //DEFAULT STYLE //apply default regular styles if (state == eResponsiveState.None) { state = eResponsiveState.Regular; //clear existing responsive styles if any removeExistingStyles(resources); //add compact style xaml to resources if (this.RegularStyles != null) { foreach (var style in this.RegularStyles) resources.Add(style); } } //STYLE SWITCHING //switch to compact styles if (state == eResponsiveState.Regular && newWidth <= this.CompactWidth) { state = eResponsiveState.Compact; //clear existing responsive styles if any removeExistingStyles(resources); //add compact style xaml to resources if (this.CompactStyles != null) { foreach (var style in this.CompactStyles) resources.Add(style); } } //switch to regular styles else if (state == eResponsiveState.Compact && newWidth > this.CompactWidth) { state = eResponsiveState.Regular; //clear existing responsive styles if any removeExistingStyles(resources); //add regular style xaml to resources if (this.RegularStyles != null) { foreach (var style in this.RegularStyles) resources.Add(style); } } }
void determineStyle(double newHeight, IList<ResourceDictionary> resources) { //STYLE SWITCHING //switch to compact styles if ((state == eResponsiveState.Regular || state == eResponsiveState.None) && newHeight <= this.CompactHeight) { state = eResponsiveState.Compact; //clear existing responsive styles if any removeExistingStyles(resources); //add compact style xaml to resources if (this.CompactStyles != null) { foreach (var style in this.CompactStyles) resources.Add(style); } } //switch to regular styles else if ((state == eResponsiveState.Compact || state == eResponsiveState.None) && newHeight > this.CompactHeight) { state = eResponsiveState.Regular; //clear existing responsive styles if any removeExistingStyles(resources); //add regular style xaml to resources if (this.RegularStyles != null) { foreach (var style in this.RegularStyles) resources.Add(style); } } }