

Private Sub dgv_Clients_RowFormatting(sender As System.Object, e As Telerik.WinControls.UI.RowFormattingEventArgs) Handles dgv_Clients.RowFormatting
Dim ClientBound As Client = TryCast(e.RowElement.Data.DataBoundItem, Client)
If ClientBound IsNot Nothing AndAlso Helper.ActiveDirectoryHelper.GetInstance.GetCurrentUser.Guid.Equals(ClientBound.FK_OwnerUser) Then
e.RowElement.DrawFill = True
e.RowElement.BackColor = Color.Red
e.RowElement.BackColor2 = Color.White
e.RowElement.BackColor3 = Color.White
e.RowElement.BackColor4 = Color.White
e.RowElement.GradientStyle = GradientStyles.Linear
e.RowElement.GradientAngle = 360
Else
e.RowElement.ResetValue(LightVisualElement.DrawFillProperty, ValueResetFlags.Local)
e.RowElement.ResetValue(LightVisualElement.BackColorProperty, ValueResetFlags.Local)
e.RowElement.ResetValue(LightVisualElement.BackColor2Property, ValueResetFlags.Local)
e.RowElement.ResetValue(LightVisualElement.BackColor3Property, ValueResetFlags.Local)
e.RowElement.ResetValue(LightVisualElement.BackColor4Property, ValueResetFlags.Local)
e.RowElement.ResetValue(LightVisualElement.GradientStyleProperty, ValueResetFlags.Local)
e.RowElement.ResetValue(LightVisualElement.GradientAngleProperty, ValueResetFlags.Local)
End If
End Sub
private void rlvLegend_VisualItemCreating(object sender, ListViewVisualItemCreatingEventArgs e){ e.VisualItem = new LegendCustomVisualItem(); }protected override void CreateChildElements(){ base.CreateChildElements(); this.stackLayout = new StackLayoutPanel(); this.stackLayout.Orientation = Orientation.Vertical; this.stackLayout.EqualChildrenWidth = true; //Header space this.p1 = new RadPanelElement(); p1.AutoSize = true; p1.MinSize = new Size(200, 20); p1.NotifyParentOnMouseInput = true; p1.ShouldHandleMouseInput = false; p1.PanelBorder.Visibility = ElementVisibility.Hidden; this.stackLayout.Children.Add(p1); this.stackLayout.Children.Add(new LegendCustomStack("Test 1", Color.Red, Color.Red)); this.stackLayout.Children.Add(new LegendCustomStack("Test 2", Color.Blue, Color.Red)); this.stackLayout.Children.Add(new LegendCustomStack("Test 3", Color.Aquamarine, Color.Red)); this.stackLayout.Children.Add(new LegendCustomStack("Test 4", Color.DimGray, Color.Red)); this.Children.Add(this.stackLayout);}public class LegendCustomStack : StackLayoutPanel{ private int _height = 15; public LegendCustomStack(string labelText, Color fillColor, Color outlineColor) { //spacer panel RadPanelElement p2; p2 = new RadPanelElement(); p2.AutoSize = true; p2.MinSize = new Size(25, _height); p2.NotifyParentOnMouseInput = true; p2.ShouldHandleMouseInput = false; p2.PanelBorder.Visibility = ElementVisibility.Hidden; this.Children.Add(p2); RadPanelElement p3 = new RadPanelElement(); p3.AutoSize = false; p3.Size = new Size(_height, _height); p3.PanelFill.NumberOfColors = 1; p3.PanelFill.BackColor = fillColor; p3.PanelBorder.ForeColor = outlineColor; p3.NotifyParentOnMouseInput = true; p3.ShouldHandleMouseInput = false; //p3.Alignment = ContentAlignment.MiddleLeft; this.Children.Add(p3); RadLabelElement l1 = new RadLabelElement(); l1.Text = labelText; l1.NotifyParentOnMouseInput = true; l1.ShouldHandleMouseInput = false; l1.TextAlignment = ContentAlignment.TopLeft; this.Children.Add(l1); }}chartMarginsTitle1.Bottom = ((Telerik.Charting.Styles.Unit)(resources.GetObject("chartMarginsTitle1.Bottom")));