if (dialog.ShowDialog() == true)
{
using (Stream stream = dialog.OpenFile())
{
radGridView_searchResult.Export(stream,
new GridViewExportOptions()
{
Format = format,
ShowColumnHeaders =
true,
ShowColumnFooters = true,
ShowGroupFooters =
true,
Encoding =
Encoding.GetEncoding("windows-1255"),
});
}
}
| private void crashRowEditComplete(object sender, GridViewRowEditEndedEventArgs e) |
| { |
| if (e.EditAction == GridViewEditAction.Commit |
| && e.EditOperationType == GridViewEditOperationType.Insert) |
| { |
| ApplicationState.Carrier.Crashes.Add((Crash)e.NewData); |
| ApplicationState.Carrier.Drivers.Add(((Crash)e.NewData).Driver); |
| ApplicationState.Carrier.Vehicles.Add(((Crash)e.NewData).Vehicle); |
| crashListGrid.SelectedItem = e.NewData; |
| } |
| } |
| /// <summary> |
| /// Satisfies req for IPartnerMessenger. Dynamically Loads Partner radtab content. |
| /// </summary> |
| /// <param name="PartnerType"></param> |
| /// <param name="partner"></param> |
| public void NotifyPartnerSelection(Type PartnerType, Partner partner) |
| { |
| if (PartnerType == typeof(EmailPartner)) |
| { |
| this._selectedPartner = (EmailPartner)partner; |
| this.PartnerRadTabItem.SetValue(RadTabItem.ContentProperty, new EmailPartnerView(this, (EmailPartner)partner)); |
| } |
| else if (PartnerType == typeof(NamedCallPartner)) |
| { |
| this._selectedPartner = (NamedCallPartner)partner; |
| this.PartnerRadTabItem.SetValue(RadTabItem.ContentProperty, new NamedCallPartnerView(this, (NamedCallPartner)partner)); |
| } |
| else if (PartnerType == typeof(AnonymousCallPartner)) |
| { |
| this._selectedPartner = (AnonymousCallPartner)partner; |
| this.PartnerRadTabItem.SetValue(RadTabItem.ContentProperty, new AnonymousCallPartnerView(this, (AnonymousCallPartner)partner)); |
| } |
| else |
| ClientErrorHelper.ShowError(new Exception("Stuff went wrong")); |
| } |
I have tried it as just setting the content property directly as well. Basically it works for the first assignment to the content property and then all other setting attempts although the radtabitem.content property changes, the user control displayed in the tab does not change.
I’m using a generic item wrapper defined as below:
public class ItemWrapper
{
public State State { get; set; }
public string Message { get; set; }
public object Item { get; set; }
}
public enum State
{
Ok,
Warning,
Error
}
The ItemWrapper could contain objects from different classes in the Item property; for instance:
ItemWrapper wrapper = new ItemWrapper();
wrapper.Item = new Company() {Id = "Acme", Desc="Acme company" };
The point is how to bind RadGridView columns to show both ItemWrapper columns (State and Message) and wrapped object columns ( Company.Id and Company.Desc).
Binding ItemWrapper properties is ok while the expected way for Company should be:
col.DataMemberBinding = new Binding("Item.Id");
col.DataType = typeof(string);
that seems, at least, to work but raising lot of exceptions:
A first chance exception of type 'System.ArgumentException' occurred in Telerik.Windows.Data.dll
that slow down rows loading to several second for few items (making control unusable) .
Sincerely