Two questions / issues. Easy one first.
a) How do I control the alignment of the checkbox that appears in a ListViewDataItem? It seems stuck in the middle and I'd like to align it with my text.
b) I'm creating custom ListViewDataItems, as I need to add a "legend" to each drop down. Here's the sample code I'm using...
First, the code in _VisualItemCreating
Second, the override of CreateChildElements
Lastly, the other items I've created in the last couple lines..
When I load up my items, it looks fine, until I have too many that the scroll bars appear. If I scroll down, everything is fine. If I scroll up, the LegendCustomStack items seem to jump around randomly from ListDataItem to ListDataItem (sometimes completely disappearing)
(I created a version where, the colours were random to better demonstrate the behavior, but I think I backout out those changes)
Any ideas what I'm doing wrong?
Thanks!!!
Rob.
a) How do I control the alignment of the checkbox that appears in a ListViewDataItem? It seems stuck in the middle and I'd like to align it with my text.
b) I'm creating custom ListViewDataItems, as I need to add a "legend" to each drop down. Here's the sample code I'm using...
First, the code in _VisualItemCreating
private
void
rlvLegend_VisualItemCreating(
object
sender, ListViewVisualItemCreatingEventArgs e)
{
e.VisualItem =
new
LegendCustomVisualItem();
}
Second, the override of CreateChildElements
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);
}
Lastly, the other items I've created in the last couple lines..
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);
}
}
When I load up my items, it looks fine, until I have too many that the scroll bars appear. If I scroll down, everything is fine. If I scroll up, the LegendCustomStack items seem to jump around randomly from ListDataItem to ListDataItem (sometimes completely disappearing)
(I created a version where, the colours were random to better demonstrate the behavior, but I think I backout out those changes)
Any ideas what I'm doing wrong?
Thanks!!!
Rob.