I have the blow routine
private void btn_ExportExcel(object sender, RoutedEventArgs e)
{
if (dgResults.DataContext == null) return;
var extension = "xls";
var dialog = new Microsoft.Win32.SaveFileDialog()
{
DefaultExt = extension,
Filter = String.Format("{1} files (*.{0})|*.{0}|All files (*.*)|*.*", extension, "Excel"),
FilterIndex = 1
};
if (dialog.ShowDialog() == true)
{
dgResults.ElementExporting -= ElementExporting;
dgResults.ElementExporting += ElementExporting;
using (var stream = dialog.OpenFile())
{
// dgResults.ExportSettings.ExportOnlyData = true;
// dgResults.ExportSettings.UseItemStyles = true;
dgResults.Export(stream,
new GridViewExportOptions()
{
Format = ExportFormat.Html,
ShowColumnHeaders = true,
ShowColumnFooters = false,
ShowGroupFooters = false,
});
}
MessageBox.Show("Exporting to Excel has completed successfully");
}
}
The routine is executing succesfully, after saving the resultant Excel, when I try to open it, its showing an error messsage as below...
"The file format and extension of 'File1.xls' don't match. The file could be currupted or unsafe. Unless you trust its source, don't open it. Do you want to open it anyway?"
I tried with different formats like csv, html, ExcelML, the same error pops out. When I click 'Yes', its opening with the perfect data.
I would like to request, any help to fix this issue.
Thanks in advance.
Hello,
I'm developing a new App using telerik wizard.
I'm currently exploring the possibility to add dynamic wizard pages, but i need to change the ButtonsVisibilityMode in the source code, i.e.,
<p>using xaml it would be like:</p><p></p><p>ButtonsVisibilityMode="Cancel,Next"</p>
Does anyone know how i can do this in c#?
I have tried:
<p> WizardPage wizardPage = new WizardPage()<br> {</p><p> ButtonsVisibilityMode = "Next, Cancel"</p><p>};</p>
But I'm getting the following error: cannot convert 'string' to WizardPageButtonsDisplayMode.
Can anyone help me?
Regards


Hi,
I'm using following method to translate the header of my datagrid columns:
protected override object ProvideDynamicValue(IServiceProvider serviceProvider)
{
//if (UsersModel.LoggedInUser == null)
// throw new Exception("User not identified !");
if (DesignerProperties.GetIsInDesignMode(new System.Windows.DependencyObject()))
return ResourceName;
var rootObjectProvider = serviceProvider.GetService(typeof(IRootObjectProvider)) as IRootObjectProvider;
var fqName = Global == "False" ? rootObjectProvider?.RootObject.GetType().FullName : "Global";
return TranslationBL.GetTranslation(!string.IsNullOrWhiteSpace(fqName) ? fqName + "_" + ResourceName : ResourceName);
}
In XAML:
<telerik:GridViewDataColumn Header="{bx:LocalizeBinding Customer, Global=True}" DataMemberBinding="{Binding CustomerShortName}"/>
Uptill now this was working great. Now I have a DataGrid defined in a RowDetailsTemplate:
<telerik:RadGridView.RowDetailsTemplate>
<DataTemplate>
<TabControl>
<TabItem Header="Fini" Background="LightGray">
<telerik:RadGridView ItemsSource="{Binding StockFiniDetails}" ShowSearchPanel="False" SelectionMode="Single" AlternationCount="0" MaxHeight="350">
<telerik:RadGridView.Resources>
<Style TargetType="telerik:GridViewHeaderCell">
<Setter Property="Background" Value="LightGray"/>
</Style>
</telerik:RadGridView.Resources>
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn Header="{bx:LocalizeBinding Variant, Global=True}" DataMemberBinding="{Binding Variant}"/>
<telerik:GridViewDataColumn Header="{bx:LocalizeBinding StockSpec, Global=True}" DataMemberBinding="{Binding StockSpec}"/>
<telerik:GridViewDataColumn Header="{bx:LocalizeBinding Passe, Global=True }" DataMemberBinding="{Binding Passe}"/>
<telerik:GridViewDataColumn Header="{bx:LocalizeBinding PartNumber, Global=True }" DataMemberBinding="{Binding PartNumber}"/>
<telerik:GridViewDataColumn Header="Rayon" DataMemberBinding="{Binding Rayon}"/>
<telerik:GridViewDataColumn Header="{bx:LocalizeBinding GrossLength, Global=True }" DataMemberBinding="{Binding GrossLength}" DataFormatString="{} {0:N2}" CellStyle="{StaticResource TelerikGridViewCellRightAlignedStyle}"/>
<telerik:GridViewDataColumn Header="{bx:LocalizeBinding NetLength, Global=True }" DataMemberBinding="{Binding NetLength}" DataFormatString="{} {0:N2}" CellStyle="{StaticResource TelerikGridViewCellRightAlignedStyle}"/>
<telerik:GridViewDataColumn Header="{bx:LocalizeBinding CostPrice, Global=True }" DataMemberBinding="{Binding CostPrice}" DataFormatString="{} {0:N2}" CellStyle="{StaticResource TelerikGridViewCellRightAlignedStyle}"/>
<telerik:GridViewDataColumn Header="{bx:LocalizeBinding Date, Global=True}" DataMemberBinding="{Binding StockDate}" Style=" {StaticResource TelerikGridViewDataColumnShortDateStyle}"/>
<telerik:GridViewDataColumn Header="{bx:LocalizeBinding Comment, Global=True}" DataMemberBinding="{Binding Comment}"/>
<telerik:GridViewDataColumn Header="{bx:LocalizeBinding Invoice, Global=True}" DataMemberBinding="{Binding InvoiceNumber}"/>
<telerik:GridViewDataColumn Header="{bx:LocalizeBinding VIS_ASPECT}" DataMemberBinding="{Binding VisAspect}"/>
<telerik:GridViewDataColumn Header="{bx:LocalizeBinding TEC_ASPECT}" DataMemberBinding="{Binding TecApsect}"/>
</telerik:RadGridView.Columns>
</telerik:RadGridView>
</TabItem>
</TabControl>
</DataTemplate>
</telerik:RadGridView.RowDetailsTemplate>
In this case
var rootObjectProvider = serviceProvider.GetService(typeof(IRootObjectProvider)) as IRootObjectProvider;
returns null resulting in an invalid translation.
I found out that the ServiceProvider is of type MS.Internal.ServiceProviderContext when the ProvideDynamicValue(IServiceProvider serviceProvider) is called from a 'normal' DataColumn. When called from a DataColumn defined in a RowDetailsTemplate, the ServiceProvider is of type System.Windows.Markup.ProviceValueServiceProvider.
How can I solve this ?
Best Regards,
Hans

Hi.
I use GridViewDataColumn.CellTemplate. I have a bool SatisfiesSearch property and I want use DataTrigger to collapsed rows.
<telerik:RadGridView.RowStyle >
<Style TargetType="telerik:GridViewRow">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=SatisfiesSearch, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Value="False">
<Setter Property="Visibility" Value="Collapsed"/>
<Setter Property="MinHeight" Value="0"/>
<Setter Property="Height" Value="0"/>
<Setter Property="MaxHeight" Value="0"/>
</DataTrigger>
</Style.Triggers>
</Style>
</telerik:RadGridView.RowStyle>
It really works, but rows don't disappear, they hide.
Can you help me?
Hi
In my application the user should be able to switch between layouts at runtime. The hosted content (Radpanes content) can be different.
How do I achieve this.
I loading the initial layout works as expected. Dynamically adding Panes works too.
But if I call the LoadLayout Method again, nothing happens.
public void LoadLayout(string layoutData)
{
using (var ms = new MemoryStream())
{
using (var sw = new StreamWriter(ms))
{
sw.Write(layoutData);
sw.Flush();
ms.Position = 0;
_dockingManager.LoadLayout(ms);
}
}
}
Before calling LoadLayout I tryed following :
(_dockingManager is RadDocking)
1) _dockingManager.Items.Clear();
2)
public bool DeletePanels(List<Guid> moduleIDs)
{
if (_dockingManager != null)
{
try
{
foreach (Guid modID in moduleIDs)
{
var pane = _dockingManager.Panes.FirstOrDefault(p => RadDocking.GetSerializationTag(p).ToString().Equals(modID.ToString()));
if (pane != null)
{
((TelerikDockingPanesFactory)_dockingManager.DockingPanesFactory).RemovePaneAdapter(_dockingManager, pane);
}
}
_dockingManager.UpdateLayout();
return true;
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
}
}
return false;
}
Any ideas?
public class MemberType{ public int Id { get; set; } public string Description { get; set; }}I would like to create a graph view that shows a live data that is being received from a data sampler. This view, when running, shows, for example, the last 1000 samples.
When paused, it shows a scroll bar that allows the user to scroll back and forth and see all the sampled data.
I'm thinking of saving the data into file, so when the graph is paused, the data is read from the file using FileStream.
I saw the examples of VirtualQueryableCollectionView, but it still doesn't work.
I've tried with and without the VirtualQueryableCollectionView. I've created a collection that derives from IReadOnlyList<int> and I return 20,0000,000 as the count and I return the index as the item (this is just an example, for checking the data virtualization). However, the GetEnumerator (on both cases) is being called, and since the count is 20M, I yield return each of the items.
I was hoping that the VirtualQueryableCollectionView will somehow prevent the GetEnumerator call (or will be able to get just the relevant portion of the items).
I have seen examples where a similar tactics is being used, and a CollectionChanged event is being raised when the items are ready. However, they still return the full count, but on these examples, the GetEnumerator is called at start, and not also after the CollectionChanged event (on my code, it is called after the CollectionChanged, so I'm back to the same problem that I had), and no item is being returned using the GetEnumerator, but only with the Indexer.
What am I missing?
Can you show me an example of streaming data to chart view from a file?
(for example, have each 4 bytes in the file represent an Int32 which is the value, so the offset inside the file for a specific item will be the index * 4).
Thanks.

I have a gridviewcolumn that is bound to a DateTime (CartridgeExpiration). I am formatting the data based on the bound Property "ExpirationDateFormat". When I set the application culture to "de-DE" and provide a DataFormatString of "MM/dd/yyyy", I see '.' as the date separator in the filter list instead of '/'. I was seeing the same behavior in the dates displayed in the gridview column until I created a CellTemplate with the MultiBinding.
Here is my GridViewColumn definition:
<telerik:GridViewDataColumn DataMemberBinding="{Binding CartridgeExpiration}"
ShowFieldFilters = "False"
ShowFilterButton = "False"
DataFormatString="{Binding ExpirationDateFormat}"
HeaderCellStyle="{StaticResource SharedRadGridHeaderCellSmallFont3LineStyle}">
<telerik:GridViewDataColumn.Header>
<TextBlock AutomationProperties.AutomationId="QcHistoryCartridgeExpirationHeader"
Text="{x:Static AdminStrings.QcHistoryCartridgeExpirationHeader}"
TextWrapping="Wrap" TextAlignment="Center" FontSize="16"/>
</telerik:GridViewDataColumn.Header>
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock>
<TextBlock.Text>
<MultiBinding Converter="{StaticResource DateToStringConverter}">
<Binding Path="CartridgeExpiration"/>
<Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.ExpirationDateFormat"/>
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
ExpirationDate = "MM/dd/yyyy" shows in the filter as "MM.dd.yyyy"
How can I get the filter display to use the format I have provided?
Thanks.
George