public Form1()
{
InitializeComponent();
RadSplitButtonElement btnAttachFileDocument;
btnAttachFileDocument = new RadSplitButtonElement();
btnAttachFileDocument.Text = "Attach File";
btnAttachFileDocument.Click += new EventHandler(btnAttachFileDocument_Click);
btnAttachFileDocument.DropDownOpened += new EventHandler(btnAttachFileDocument_DropDownOpened);
RadLabelElement oMenuItem;
oMenuItem = new RadLabelElement();
oMenuItem.Text = "Cover Sheet";
oMenuItem.Click += new EventHandler(oMenuItem_Click);
btnAttachFileDocument.Items.Add(oMenuItem);
oMenuItem = new RadLabelElement();
oMenuItem.Text = "Master Waybill Doc";
btnAttachFileDocument.Items.Add(oMenuItem);
radRibbonBar1.CommandTabs[0].Items.Add(btnAttachFileDocument);
}
void oMenuItem_Click(object sender, EventArgs e)
{
this.Text = "Cover Sheet Clicked";
}
void btnAttachFileDocument_DropDownOpened(object sender, EventArgs e)
{
this.Text = "DropDown";
}
void btnAttachFileDocument_Click(object sender, EventArgs e)
{
this.Text = "Clicked";
}
I have 2 issues .
Firstly I cannot get a seperate event when clicking the dropdown arrow of the button or when clicking the button itself.
I want to generate a default click event if the user clicks the button but if he opens the drop down I want to wait for him
to select the appropriate item from the list. At the moment I always get the click event when the dropdown opens. How
do I prevent this ?
Secondly , with the splitbutton control I can mouseover the dropdown arrow and button seperately and it highlights them
seperately . WIth the splitbuttonelement that I add to the ribbonbar however it always highlights it all as one control always
and I can only ever see the Image regardless of the textimage relation I setup . My text is always invisible ...
private void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e) |
{ |
// exclude header element in the data column |
if (e.CellElement.ColumnInfo is GridViewDataColumn && !(e.CellElement.RowElement is GridTableHeaderRowElement)) |
{ |
GridViewDataColumn column = (GridViewDataColumn)e.CellElement.ColumnInfo; |
if (column.FieldName == "Discount") |
{ |
// check if the progress bar is already added to the cell |
if (e.CellElement.Children.Count > 0) |
return; |
RadProgressBarElement element = new RadProgressBarElement(); |
e.CellElement.Children.Add(element); |
element.StretchHorizontally = true; |
element.StretchVertically = true; |
// extract the value in the cell, convert it to a value |
// usable in the progress bar element and assign it to the |
// progress bar Value1 and Text properties |
object discountValue = e.CellElement.RowInfo.Cells["Discount"].Value; |
int discountPercentage = Convert.ToInt32(Convert.ToDecimal(discountValue) * 100); |
element.Value1 = discountPercentage; |
if (discountPercentage > 0) |
{ |
element.Text = discountPercentage.ToString() + "%"; |
} |
// apply theme to the progress bar |
ApplyThemeToElement(element, "ControlDefault"); |
} |
} |
} |
private void ApplyThemeToElement(RadItem item, string themeName) |
{ |
DefaultStyleBuilder builder = |
ThemeResolutionService.GetStyleSheetBuilder(item, themeName) as DefaultStyleBuilder; |
if (builder != null) |
//clone because control might modify it later |
item.Style = new XmlStyleSheet(builder.Style).GetStyleSheet(); |
} |
<?xml version="1.0" encoding="utf-8"?> |
<Invoices> |
<Invoice> |
<InvoiceNumber>456789</InvoiceNumber> |
<JobNumber>TTT</JobNumber> |
<CreateDate>01/03/2009 12:23:34</CreateDate> |
<Parts> |
<Part> |
<PartNumber>001</PartNumber> |
<PartDescription>Part Number 1 has expection</PartDescription> |
<PartPrice>12.99</PartPrice> |
</Part> |
<Part> |
<PartNumber>002</PartNumber> |
<PartDescription>No Part available</PartDescription> |
<PartPrice>60.00</PartPrice> |
</Part> |
</Parts> |
</Invoice> |
<Invoice> |
<InvoiceNumber>0000</InvoiceNumber> |
<JobNumber>SSSS</JobNumber> |
<CreateDate>01/01/2001 11:00:00</CreateDate> |
<Parts> |
<Part> |
<PartNumber>003</PartNumber> |
<PartDescription>Part Number3 has expection</PartDescription> |
<PartPrice>42.99</PartPrice> |
</Part> |
<Part> |
<PartNumber>004</PartNumber> |
<PartDescription>4 Part available</PartDescription> |
<PartPrice>100.00</PartPrice> |
</Part> |
</Parts> |
</Invoice> |
</Invoices> |
Dim mO As New XMLOperater |
grdvewCurrentParts.DataSource = mO.XMLToDataSet("C:\xmlfile.xml").Tables(0) |
Dim template As Telerik.WinControls.UI.GridViewTemplate = New Telerik.WinControls.UI.GridViewTemplate |
template.DataSource = mO.XMLToDataSet("C:\xmlfile.xml").Tables(1) |
grdvewCurrentParts.MasterGridViewTemplate.ChildGridViewTemplates.Add(template) |
Dim template2 As Telerik.WinControls.UI.GridViewTemplate = New Telerik.WinControls.UI.GridViewTemplate |
template2.DataSource = mO.XMLToDataSet("C:\xmlfile.xml").Tables(2) |
template.ChildGridViewTemplates.Add(template2) |
grdvewCurrentParts.MasterGridViewTemplate.ChildGridViewTemplates.Add(template2) |
Dim relation As GridViewRelation = New GridViewRelation(grdvewCurrentParts.MasterGridViewTemplate) |
Dim relation2 As GridViewRelation = New GridViewRelation(grdvewCurrentParts.MasterGridViewTemplate.ChildGridViewTemplates(template)) |
relation.ChildTemplate = template |
relation2.ChildTemplate = template2 |
relation.ParentColumnNames.Add("Invoice_Id") |
relation.ChildColumnNames.Add("Invoice_Id") relation2.ParentColumnNames.Add("Parts_Id") |
relation2.ChildColumnNames.Add("Parts_Id") |
grdvewCurrentParts.Relations.Add(relation) |
grdvewCurrentParts.Relations.Add(relation2) |