7 Answers, 1 is accepted
0
Saneesh
Top achievements
Rank 1
answered on 15 Feb 2012, 01:03 PM
Post ur code snippet..along with your Quiery please...
0
Froggie
Top achievements
Rank 1
answered on 15 Feb 2012, 01:10 PM
In ctor of my form:
Then show the form, but the background is still white.
this
.radListView1.BackColor = System.Drawing.Color.Lime;
0
Hello Froggie,
Thank you for your question.
No, this is not an issue. You are not able to see the background image or the back color of the control, because the main element of the control (RadListViewElement) is hiding it. In this case you can either set the back color or the background image of the RadListViewElement, or you can set the back color of RadListViewElement to transparent and then use the properties of the control. The attached screenshot demonstrates how to achieve this.
I hope you find this information useful. Feel free to ask if you have any additional questions.
Regards,
Ivan Todorov
the Telerik team
Thank you for your question.
No, this is not an issue. You are not able to see the background image or the back color of the control, because the main element of the control (RadListViewElement) is hiding it. In this case you can either set the back color or the background image of the RadListViewElement, or you can set the back color of RadListViewElement to transparent and then use the properties of the control. The attached screenshot demonstrates how to achieve this.
I hope you find this information useful. Feel free to ask if you have any additional questions.
Regards,
Ivan Todorov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Froggie
Top achievements
Rank 1
answered on 16 Feb 2012, 09:15 AM
- Thank you for your answer. It (partially) solved my problem.
- Why is this so complicated? (I think thats my problem because I don't understand the structure of youre controls.)
- Now I have another/a new problem:
After a DragDrop-event the Backcolor of the ListViewElement is reseted. this occurs immediately after removing a Item from the BindingList where the ListView is bound to.
private
void
Form1_Load(
object
sender, EventArgs e)
{
RefreshGrid();
}
private
void
RefreshGrid()
{
radListView1.SuspendLayout();
radListView1.BeginUpdate();
radListView1.DataSource =
null
;
radListView1.DataSource = f.ViewItems;
radListView1.EndUpdate();
radListView1.ResumeLayout();
}
private
void
radListView1_DragDrop(
object
sender, DragEventArgs e)
{
var droppedPoint = radListView1.ListViewElement.PointFromScreen(
new
Point(e.X, e.Y));
if
(e.Data !=
null
)
{
ListViewDataItem draggedListViewDataItem = e.Data.GetData(
typeof
(ListViewDataItem))
as
ListViewDataItem;
if
(draggedListViewDataItem !=
null
)
{
//PinboardViewItem is my Business-class
var draggedPinboardViewItem = draggedListViewDataItem.DataBoundItem
as
PinboardViewItem;
PinboardViewItem droppedPinboardViewItem =
null
;
//f.ViewItems is the BindingList
var indexOfDraggedItem = f.ViewItems.IndexOf(draggedPinboardViewItem);
int
indexOfDroppedItem;
var droppedVisualItem = findPinboardVisualItem(droppedPoint)
as
BaseListViewVisualItem;
if
(droppedVisualItem !=
null
)
{
droppedPinboardViewItem = droppedVisualItem.Data.DataBoundItem
as
PinboardViewItem;
indexOfDroppedItem = f.ViewItems.IndexOf(droppedPinboardViewItem);
}
else
{
indexOfDroppedItem = f.ViewItems.Count - 1;
}
//BackColor is still Lime
f.ViewItems.Remove(draggedPinboardViewItem);
//BackColor is still reseted to default-value
f.ViewItems.Insert(indexOfDroppedItem, draggedPinboardViewItem);
}
}
}
Why is the Backcolor reseted?
Edit:
- I'm using the Theme "Windows 7"
- the BackColor of the RadListView is still Lime, but the BackColor of RadListViewElement is reseted to White. <- Why?
0
Accepted
Hello Froggie,
Indeed, the structure of our controls may seem complicated at first, but this way a lot of customization abilities are allowed.
As to your issue with the back color being reset, I have tested the sample project you have sent in a thread named "scroll Listview while dragging item". The reason for resetting the back color to white is the following code:
The Owner of a ListViewDataItem is RadListViewElement - the main element of the control and by calling the ResetValue method, the specified properties are reset to their default value. Removing the ResetValue calls fixes this issue.
I hope you find this helpful. Should you have any further questions, do not hesitate to ask.
Kind regards,
Ivan Todorov
the Telerik team
Indeed, the structure of our controls may seem complicated at first, but this way a lot of customization abilities are allowed.
As to your issue with the back color being reset, I have tested the sample project you have sent in a thread named "scroll Listview while dragging item". The reason for resetting the back color to white is the following code:
private
void
radListView1_SelectedItemChanged(
object
sender, EventArgs e)
{
if
(lastSelectedItem !=
null
)
{
lastSelectedItem.Owner.ResetValue(LightVisualElement.BackColorProperty, ValueResetFlags.Local);
lastSelectedItem.Owner.ResetValue(LightVisualElement.BorderColorProperty, ValueResetFlags.Local);
}
//...
The Owner of a ListViewDataItem is RadListViewElement - the main element of the control and by calling the ResetValue method, the specified properties are reset to their default value. Removing the ResetValue calls fixes this issue.
I hope you find this helpful. Should you have any further questions, do not hesitate to ask.
Kind regards,
Ivan Todorov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Froggie
Top achievements
Rank 1
answered on 20 Feb 2012, 03:54 PM
Thank you for your reply.
This solved my issue (within this thread).
I just copied the code from other examples.
This solved my issue (within this thread).
I just copied the code from other examples.
0
Hello Sebastian,
Nikolay
the Telerik team
We are glad to hear that our assistance has helped you. Write back if you have additional questions.
Greetings,Nikolay
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>