# C1.Win.FlexGrid.CellRange.Style

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Win_FlexGrid_CellRange_Style_" data-uid="C1.Win.FlexGrid.CellRange.Style*">Style Property
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Win_FlexGrid_CellRange_Style_" data-uid="C1.Win.FlexGrid.CellRange.Style*"></a>
<h4 id="C1_Win_FlexGrid_CellRange_Style" data-uid="C1.Win.FlexGrid.CellRange.Style">Style</h4>
<div class="markdown level1 summary"><p>Gets or sets the style used to display every cell in the range.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public CellStyle Style { get; set; }</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Property Style As CellStyle</code></pre>
</div>
<h5 id="C1_Win_FlexGrid_CellRange_Style_remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>Getting or setting the range style ensures that every cell in the range has
the same style. If the range does not contain any cells with custom styles,
this property returns null.</p>
</div>
<h5 id="C1_Win_FlexGrid_CellRange_Style_examples">Examples</h5>
<p>The code below creates a <a class="xref" href="C1.Win.FlexGrid.CellRange.html">CellRange</a> structure and uses it to
apply a custom style to the entire range.</p>
<pre><code class="lang-csharp">// create a style
CellStyle cs = _flex.Styles.Add("red");
cs.BackColor = Color.Red;

// create a cell range and assign it a style
CellRange rg = _flex.GetCellRange(1, 1, 5, 5);
rg.Style = cs;</code></pre>

</div>
