I want to do something similar (I think) to this:
http://www.telerik.com/help/winforms/listview-custom-items.html
What I want to do is this: I have a RadListView control with 4 columns in a ViewType of DetailsView. The first 3 columns will just display some text in each cell/row, but the 4th cell in each row I want to have a "Remove" button to remove it from the list. So what I need to be able to do is:
Create a Button element to serve as the value for the 4th cell in each row
and
Be able to define and handle the click event for that button (will need some way to identify the row that the button was clicked for as well)
The code I have right now (created based on the example) just displays the button in the first column and none of the text for the first 3 columns seems to get created/inserted.
and my handler...
I don't know how to tell it to only make the VisualItem be the button for the 4th column, not all of them.
Thanks,
--Jason
http://www.telerik.com/help/winforms/listview-custom-items.html
What I want to do is this: I have a RadListView control with 4 columns in a ViewType of DetailsView. The first 3 columns will just display some text in each cell/row, but the 4th cell in each row I want to have a "Remove" button to remove it from the list. So what I need to be able to do is:
Create a Button element to serve as the value for the 4th cell in each row
and
Be able to define and handle the click event for that button (will need some way to identify the row that the button was clicked for as well)
The code I have right now (created based on the example) just displays the button in the first column and none of the text for the first 3 columns seems to get created/inserted.
public class ListViewItemButton : SimpleListViewVisualItem { private RadButtonElement buttonElement; private LightVisualElement contentElement; private StackLayoutPanel stackLayout; protected override void CreateChildElements() { base.CreateChildElements(); this.stackLayout = new StackLayoutPanel(); this.stackLayout.Orientation = Orientation.Horizontal; this.stackLayout.EqualChildrenWidth = true; this.contentElement = new LightVisualElement(); this.contentElement.StretchHorizontally = true; this.contentElement.MinSize = new Size(60, 0); this.stackLayout.Children.Add(this.contentElement); this.buttonElement = new RadButtonElement(); this.buttonElement.Text = "Remove "; this.stackLayout.Children.Add(this.buttonElement); this.Children.Add(this.stackLayout); } protected override void SynchronizeProperties() { base.SynchronizeProperties(); this.Text = ""; this.buttonElement.Text = "Remove "; } protected override Type ThemeEffectiveType { get { return typeof(SimpleListViewVisualItem); } } }}and my handler...
private void HandleRadListViewVisualItemCreating(object sender, ListViewVisualItemCreatingEventArgs e) { e.VisualItem = new ListViewItemButton(); }I don't know how to tell it to only make the VisualItem be the button for the 4th column, not all of them.
Thanks,
--Jason