Im able to export the contents of radgridview to PDF, however I want to mail the contents as PDF attachment in outlook without saving it on my system
How to achieve this?
I have table x in a database having around 30 columns with 6000 records.
When bind this table data in xaml using a class representation say List<X>, then on Export I get a Out of Memory Exception.
But when I Export the same table data using DataTable, then I do not get any exception.
I wanted to the reason behind this behavior ?
I need to have formatted numbers in RadGridView, my columns looks like below:
<telerik:GridViewDataColumn DataMemberBinding="{Binding MarketValue}"
DataFormatString="n2">
<telerik:GridViewDataColumn.CellEditTemplate>
<DataTemplate>
<TextBox Text="{Binding MarketValue, StringFormat=n2}"></TextBox>
</DataTemplate>
</telerik:GridViewDataColumn.CellEditTemplate>
</telerik:GridViewDataColumn>
based on this post: http://www.telerik.com/forums/numeric-input-with-decimals-in-gridviewmaskedinputcolumn#oNu7_qiNFkS-vjfxCML3sQ
I want to have an opportunity to copy multiple cells from the Grid and paste them into excel file or notepad and it works out-of-th-box.
Unfortunately I cannot reverse it - I cannot change some values in excel file, copy them and paste into RadGridView. Is there any way to do it easily?
Hi guys!
I was tasked with finding a way to rewrite our old WinForms app to WPF (due to some experience with it in time long past), with special attention for PropertyGrid controls. Decided to go with Telerik and to my surprise it has the same problem as most open source solutions, namely: when binding to PropertyBag containing enum definitions, enum values are not selected in the dropdowns - the options are there, just unselected. I'm pretty sure I do something wrong, so I'd appreciate a look at the code and some tips. Code for View, ViewModel and CustomProperty/Descriptor can be found below:
View:
1.<Window.Resources>2. <my:MyViewModel x:Key="MyViewModel"/>3. </Window.Resources>4. <Grid DataContext="{StaticResource MyViewModel}">5. <telerik:RadPropertyGrid HorizontalAlignment="Left" Name="radPropertyGrid1" VerticalAlignment="Top" Height="452" Width="465" Item="{Binding Collection}"/>6. </Grid>ViewModel:
01.public class MyViewModel : INotifyPropertyChanged02. {03. public event PropertyChangedEventHandler PropertyChanged;04. ObservableCollection<CustomProperty> cpList = new ObservableCollection<CustomProperty>()05. {06. new CustomProperty { Name = "Foo", Desc = "Test", Type = typeof(int), Value1 = 0 },07. new CustomProperty { Name = "Foo2", Desc = "Test2", Type = typeof(int), Value1 = 1 },08. new CustomProperty { Name = "Foo3", Desc = "Test3", Type = typeof(WpfApplication1.Enum), Value1 = WpfApplication1.Enum.Value2 }09. };10. 11. public PropertyBag Collection12. {13. get14. {15. return new PropertyBag(cpList);16. }17. }18. 19. private object selectedItem;20. public object SelectedItem21. {22. get { return this.selectedItem; }23. set24. {25. if (value != this.selectedItem)26. {27. this.selectedItem = value;28. this.OnPropertyChanged("SelectedItem");29. }30. }31. }32. 33. protected virtual void OnPropertyChanged(PropertyChangedEventArgs args)34. {35. PropertyChangedEventHandler handler = this.PropertyChanged;36. if (handler != null)37. {38. handler(this, args);39. }40. }41. 42. private void OnPropertyChanged(string propertyName)43. {44. this.OnPropertyChanged(new PropertyChangedEventArgs(propertyName));45. }46. }CustomProperty/Descriptor:
001.public enum Enum002. {003. Value1 = 1,004. Value2 = 2005. }006. 007. public class CustomProperty008. {009. public string Name { get; set; }010. public string Desc { get; set; }011. public object DefaultValue { get; set; }012. public object Value1 013. { 014. get { return currentValue; } 015. set016. { 017. currentValue = value;018. } 019. }020. 021. Type type;022. public Type Type023. {024. get025. {026. return type;027. }028. set029. {030. type = value;031. DefaultValue = Activator.CreateInstance(value);032. }033. }034. 035. private bool validate;036. private PropertyBag subProperty;037. private object currentValue;038. 039. private string GetText(string textId)040. {041. return textId;042. }043. 044. public string Id045. {046. get { return string.Empty; }047. }048. 049. public string Category050. {051. get { return "Category"; }052. }053. 054. public string Hint055. {056. get057. {058. return "Hint";059. }060. }061. 062. public bool UpperCase063. {064. get { return false; }065. }066. 067. public string EditorTypeName068. {069. get { return "Naaah"; }070. }071. 072. public string DropDownEditor073. {074. get { return "Uh-uh"; }075. }076. 077. public string Caption078. {079. get { return Name; }080. }081. 082. public string TypeName083. {084. get { return type.ToString(); }085. }086. 087. public bool PermanentReadOnly088. {089. get { return false; }090. }091. 092. public bool ReadOnly093. {094. get { return false; }095. }096. 097. public string MinValue098. {099. get { return ""; }100. }101. 102. public string MaxValue103. {104. get { return "0"; }105. }106. 107. public bool Validate108. {109. get { return validate; }110. }111. 112. public PropertyBag SubProperty113. {114. get {return subProperty;}115. set {subProperty = value;}116. }117. 118. public int SortOrder119. {120. get { return 0; }121. }122. 123. public bool Hide124. {125. get { return false; }126. }127. 128. public string DevTypeConverter129. {130. get { return "None"; }131. }132. 133. public string GetAttribute(string key)134. {135. return "";// this.deviceData != null ? this.deviceData.GetAttribute(key) : null;136. }137. }138. 139. public class CustomPropertyDescriptor : PropertyDescriptor140. {141. public CustomProperty pSpec = null;142. public PropertyBag pBag;143. 144. public CustomPropertyDescriptor(CustomProperty cp, PropertyBag pb, Attribute[] attrs) : base(cp.Name, attrs)145. {146. pSpec = cp;147. pBag = pb;148. }149. 150. public override Type ComponentType151. {152. get { return typeof(CustomProperty); }153. }154. 155. public override object GetValue(object component)156. {157. if (pSpec.DefaultValue is System.Enum)158. return (int)pSpec.Value1;159. return pSpec.Value1; 160. }161. 162. public override bool IsReadOnly163. {164. get { return false; }165. }166. 167. public override Type PropertyType168. {169. get170. {171. return pSpec.Type;172. }173. }174. 175. public override void ResetValue(object component)176. {177. SetValue(component, pSpec.DefaultValue);178. }179. 180. public override void SetValue(object component, object value)181. {182. pSpec.Value1 = value;183. }184. 185. private string GetText(string textId)186. {187. return textId;188. }189. 190. public string GetPropId191. {192. get193. { return pSpec.Id; }194. }195. 196. public override string Category197. {198. get199. {200. return pSpec.Category;201. }202. }203. 204. public override string DisplayName205. {206. get207. {208. return pSpec.Caption;209. }210. }211. 212. public override string Description213. {214. get215. {216. return pSpec.Hint;217. }218. }219. 220. public override bool IsBrowsable221. {222. get223. {224. return true;225. }226. }227. 228. public override bool CanResetValue(object component)229. {230. return false;231. }232. 233. public override bool ShouldSerializeValue(object component)234. {235. if (pSpec.TypeName == "BoolDefined")236. {237. if (pSpec.Value1 == null)238. return false;239. if (pSpec.Value1.ToString().Length > 0)240. if (Convert.ToBoolean(pSpec.Value1, CultureInfo.InvariantCulture))241. return true;242. }243. return false;244. }245. }Thanks in advance for any help you can offer:)
It seems that all what the IsGrouped property does is decide if the properties appeared as grouped or not, and clicking on A-Z doesn't sort them from A-Z (unlike for example in Visual Studio).
I've created an example where the item is:
public class MyClass{ [Display(Name="A-Name", GroupName="Group2", Order=9)] public string AName { get; set; } [Display(Name="B-Name", GroupName="Group2", Order=7)] public string BName { get; set;} [Display(Name = "C-Name", GroupName = "Group2", Order = 8)] public string CName { get; set; } [Display(Name = "D-Name", GroupName = "Group1", Order = 3)] public string DName { get; set; } [Display(Name = "E-Name", GroupName = "Group1", Order = 2)] public string EName { get; set; } [Display(Name = "F-Name", GroupName = "Group1", Order = 1)] public string FName { get; set; }}
When the A-Z button is selected, the properties are ordered as:
F-Name
E-Name
D-Name
B-Name
C-Name
A-Name
Just like the order I've defined. But with any other normal property grid, the order only affects the items when they are grouped.
The visibility of these buttons is called "SortAndGroupButtonsVisibility", so theoretically, this button should have sorted the properties alphabetically.
Hi,
I'm unable to get the dialogs to show up while using implicit theming with Office2013. Please see the attached image and zip file with the sample solution.
I made sure to include the required DLLs and use MEF loading. Can you please indicate what's missing?
Without the dialogs the word processor cannot be used.
Thanks
Hi,
If you set the Item to an IEnumerable, the control strips away all the Attributes of the source properties. For example, the DisplayNameAttribute, or the DescriptionAttribute (all of them). So, what you get is with one item, you see the display names of properties as declared in the class, but then if you supply a List of 2 items, all the display names are shown as the original property name. Kind of odd.
To further confirm, if I hook onto the AutoGeneratingPropertyDefinition event, and I want to add logic like suppress a property if it has the MergableProperty(false) attribute, well, I can't, because the PropertyDefinition.SourceProperty.Descriptor you supply has no Attributes. The collection is empty. You've supplanted the original PropertyDescriptor with a PropertySetPropertyDescriptor that has stripped away much useful information.
Luckily, I can work around all of these problems by matching up property names with the original PropertyDescriptors for the given type, and then fixing up the property definitions, but I don't know, I think you can do this a lot better.
Also, it seems necessary to have to switch the PropertySetMode between 'None' and 1 of the other choices when going from single item to multiple items. Why? Why can't the logic be smart enough to say, if Item is not an IEnumerable, then do single item properties, else if multiple items, then do multi-item logic. The property should not need to change. Changing PropertySetMode causes an internal Refresh, so we must set Item to null first. There are other quirky behaviors I've noticed when going to and from single-item mode and multi-item mode, like with the CategoryAttribute, it can stick in the UI when in Grouped mode, even though the Category heading should disappear, but I'll wait to see what you say to all of this.