So I have a working save/load for my RadPivotGrid with LocalDataProvider, but had performance concerns so added set of wrappers and functionality for QueryableDataProvider.
My wrappers and set with properties (get; set;) of types int, double, string, bool?, string, MyEnum, DateTime[DisplayFormat(DataFormatString = "{0:dd-MM-yyyy}", ApplyFormatInEditMode = true)]
Im not applying any custom aggregates or similar, and in this example I had 1 column, 1 row property and 'count' of ItemID value.
The code works fine with LocalDataProvider (though not using wrappers there, instead more complex EF entities), but wit h my lighter QueryableDataProvider datasource it now my export throws an exception when it hits the serialize command `provider.Serialize(this.xPivotGrid_Reports.DataProvider)`
---
An exception of type 'System.Runtime.Serialization.SerializationException' occurred in System.Runtime.Serialization.dll but was not handled in user code
Additional information: Type 'Telerik.Pivot.Queryable.QueryablePropertyAggregateDescription' with data contract name 'QueryablePropertyAggregateDescription:http://schemas.datacontract.org/2004/07/Telerik.Pivot.Queryable' is not expected. Consider using a DataContractResolver if you are using DataContractSerializer or add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to the serializer.
---
I cant remember original source, but I found the DataContract code online and changed very little.
And I am aware that the DataProviderSerializer subclass (where KnownTypes is defined) is called LocalDataSourceSerializer, but thats part of question:
Is there another list like `PivotSerializationHelper.KnownTypes` I should be using, because it seems comprehensive enough and im hardly doing anything strange?
---
[DataContract]
public class DataProviderSettings
{
[DataMember]
public object[] Aggregates { get; set; }
[DataMember]
public object[] Filters { get; set; }
[DataMember]
public object[] Rows { get; set; }
[DataMember]
public object[] Columns { get; set; }
[DataMember]
public int AggregatesLevel { get; set; }
[DataMember]
public PivotAxis AggregatesPosition { get; set; }
}
public class LocalDataSourceSerializer : DataProviderSerializer
{
public override IEnumerable<Type> KnownTypes
{
get
{
return PivotSerializationHelper.KnownTypes;
}
}
}
public abstract class DataProviderSerializer
{
public abstract IEnumerable<Type> KnownTypes { get; }
public string Serialize(object context)
{
string serialized = string.Empty;
IDataProvider dataProvider = context as IDataProvider;
if (dataProvider != null)
{
MemoryStream stream = new MemoryStream();
DataProviderSettings settings = new DataProviderSettings()
{
Aggregates = dataProvider.Settings.AggregateDescriptions.OfType<object>().ToArray(),
Filters = dataProvider.Settings.FilterDescriptions.OfType<object>().ToArray(),
Rows = dataProvider.Settings.RowGroupDescriptions.OfType<object>().ToArray(),
Columns = dataProvider.Settings.ColumnGroupDescriptions.OfType<object>().ToArray(),
AggregatesLevel = dataProvider.Settings.AggregatesLevel,
AggregatesPosition = dataProvider.Settings.AggregatesPosition
};
DataContractSerializer serializer = new DataContractSerializer(typeof(DataProviderSettings), KnownTypes);
serializer.WriteObject(stream, settings);
stream.Position = 0;
var streamReader = new StreamReader(stream);
serialized += streamReader.ReadToEnd();
}
return serialized;
}
public void Deserialize(object context, string savedValue)
{
IDataProvider dataProvider = context as IDataProvider;
if (dataProvider != null)
{
var stream = new MemoryStream();
var tw = new StreamWriter(stream);
tw.Write(savedValue);
tw.Flush();
stream.Position = 0;
DataContractSerializer serializer = new DataContractSerializer(typeof(DataProviderSettings), KnownTypes);
var result = serializer.ReadObject(stream);
dataProvider.Settings.AggregateDescriptions.Clear();
foreach (var aggregateDescription in (result as DataProviderSettings).Aggregates)
{
dataProvider.Settings.AggregateDescriptions.Add(aggregateDescription);
}
dataProvider.Settings.FilterDescriptions.Clear();
foreach (var filterDescription in (result as DataProviderSettings).Filters)
{
dataProvider.Settings.FilterDescriptions.Add(filterDescription);
}
dataProvider.Settings.RowGroupDescriptions.Clear();
foreach (var rowDescription in (result as DataProviderSettings).Rows)
{
dataProvider.Settings.RowGroupDescriptions.Add(rowDescription);
}
dataProvider.Settings.ColumnGroupDescriptions.Clear();
foreach (var columnDescription in (result as DataProviderSettings).Columns)
{
dataProvider.Settings.ColumnGroupDescriptions.Add(columnDescription);
}
dataProvider.Settings.AggregatesPosition = (result as DataProviderSettings).AggregatesPosition;
dataProvider.Settings.AggregatesLevel = (result as DataProviderSettings).AggregatesLevel;
}
}
}
---
I add raddatafilter as following :
<Grid><Grid.Resources><DataTemplate x:Key="CountryComboboxTemplate" ><telerik:RadComboBox x:Name="CountryCombox2" TabIndex="3"HorizontalAlignment="Left" VerticalAlignment="Center"DisplayMemberPath="CountryName" IsTabStop="True"ClearSelectionButtonContent="Clear" ClearSelectionButtonVisibility="Visible"CanAutocompleteSelectItems="True" CanKeyboardNavigationSelectItems="True"IsEditable="True" IsReadOnly="False" IsTextSearchEnabled="True"OpenDropDownOnFocus="True" IsFilteringEnabled="True"TextSearchMode="Contains" IsDropDownOpen="False" SelectedValue="{Binding Value, Mode=TwoWay, FallbackValue=null}"Width="200" Background="{x:Null}" BorderBrush="{x:Null}" Height="30" Foreground="{DynamicResource white-forground}" Margin="0,5" Grid.Row="2" Grid.Column="2"/></DataTemplate><behaviors:EditorTemplateSelector x:Key="MyEditorTemplateSelector"><behaviors:EditorTemplateSelector.EditorTemplateRules><behaviors:EditorTemplateRule PropertyName="Country" DataTemplate="{StaticResource CountryComboboxTemplate}" /></behaviors:EditorTemplateSelector.EditorTemplateRules></behaviors:EditorTemplateSelector></Grid.Resources><telerik:RadDataFilter Name="Filter" telerik:StyleManager.Theme="Windows8"EditorCreated="OnRadDataFilterEditorCreated"Loaded="Filter_Loaded"MinHeight="193"MaxHeight="250"Width="Auto"Grid.Row="0" behaviors:FilterDescriptorBindingBehavior.FilterDescriptors="{Binding FilterDescriptors, Source={StaticResource model}}"EditorTemplateSelector="{StaticResource MyEditorTemplateSelector}"Margin="1" /></Grid>
the problem is the country not fill in the filter always country is equal too empty , not the selected country
and code behind looks like
public FilterDataUserControl(){InitializeComponent();var list = new List<FilterCriterea>();list.Add(new FilterCriterea());Filter.Source = list;}private void OnRadDataFilterEditorCreated(object sender, EditorCreatedEventArgs e){if (DataContext != null){var datacontextVm = DataContext as AdvancedSearchManagerViewModel;if (datacontextVm != null){switch (e.ItemPropertyDefinition.PropertyName){case "Country":RadComboBox countrycomboBoxEditor = (RadComboBox)e.Editor; countrycomboBoxEditor.ItemsSource = datacontextVm.CountryCollectionViewModelIns;break;}}}}private void Filter_Loaded(object sender, RoutedEventArgs e){Filter.ItemPropertyDefinitions.Add(new ItemPropertyDefinition("Country", typeof(Country), "Country"));}}
Hi, I implemented an Autocompletebox within an Edit Appointment's dialog,I was able to set the ItemsSource to be a staticresource of the viewmodel, But I can't seem to set it as a property of my CustomAppointment. May I ask how do I do that.
Also upon creation of a new appointment, I send it off to make the changes in outlook as well. But the problem is that the code below is of type IAppointment. How do I get the value of the customappointment OnSchedulerAppointmentCreated
private void OnSchedulerAppointmentCreated(object sender, AppointmentCreatedEventArgs e)
{
(this.DataContext as CalendarViewModel).NewAppointment((CustomAppointment)e.CreatedAppointment);
}
Hey all,
So to start, let me say that I have a project built out to learn with...I'm trying things out just to figure out better patterns and whatnot when building up apps since I've been doing a lot of that lately and I've started a blog to document my experiences.
What I was doing initially was creating a project to figure out which was better to use...a BackgroundWorker or Task for doing background processing of getting a data source for the grid. What I ended up with was a test app that is buried under a mountain of bad perf and it locks the UI up until it's darn good and ready to let it go. As far as I can tell in my source code...I'm not attaching any of the BackgroundWorker or Task threads to the UI thread...so I'm pretty confused as to what's going on.
If I just do one at a time, the table starts filling up with data before the RadBusyIndicator can even bring up it's UI...if I try 2 or 3...I start seeing the RadBusyIndicator doing it's thing...but the UI is still responsive. If I do all 12...the UI is stuck for a good 10 minutes (my test database has more than 250,000 records in each table).
My source files can be found at the following blog post (If you'd rather I posted them here I can do that as well...)
Any thoughts as to what I'm doing wrong? Thanks in advance. :)
I have the same issue with the DataFormComboBoxField in a RadDataForm : (more detailed : http://www.telerik.com/forums/edit-lookup-values-with-dataformcomboboxfield )
Either i get the problem i first came for, either i have this one (with a GridViewComboBoxColumn or a DataFormComboBoxField):
<telerik:GridViewComboBoxColumn Header="Retour 2"
DisplayMemberPath="Name"
DataMemberBinding="{Binding Team, Mode=TwoWay}"
ItemsSource="{Binding Paths, Source={StaticResource EscortViewModel}}"
/>
With that, when i load the usercontrol, the value is not set/displayed in the column... BUT, when i change it, it calls the set of the viewmodel and update the ViewModel (so the displayed values).
What i can't find is how mix the two to display the data when the usercontrol is loaded AND update the value !
Thank you very much
Hello!
I have a problem when using Windows8TouchTheme,
when alert in Windows8TouchTheme, the punctuations can not show incorrect.
but in windows7theme,it is all right.
I would like to set the selected PageSize when showing RadDiagramPrintPreview. How can I I achieve that as the PageInfo.PageSize property of RadDiagramPrintPreview is read only?
My diagram page size is set to Tabloid but when I lunch RadDiagramPrintPreview for my diagram the selected PageSize is set to letter.
