Telerik Forums
UI for WPF Forum
2 answers
773 views

Hello,

I am trying to export the data of my whole RadGridView to CSV.

Now I got a problem.

I used this Code:

public void PdfExport(RadGridView grid)
        {
            string extension = "pdf";

            SaveFileDialog dialog = new SaveFileDialog()
            {
                DefaultExt = extension,
                Filter = String.Format("{1} files (.{0})|.{0}|All files (.)|.", extension, "Pdf"),
                FilterIndex = 1
            };

            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                using (Stream stream = dialog.OpenFile())
                {
                    grid.ExportToPdf(stream,
                        new GridViewPdfExportOptions()
                        {
                            ShowColumnFooters = true,
                            ShowColumnHeaders = true,
                            ShowGroupFooters = true,
                            AutoFitColumnsWidth = false,
                            PageOrientation = PageOrientation.Landscape
                        });
                }
            }
        }

When I use this Code and open it with Visual Studio Code, the csv-file is comma seperated and every word is in quotes.

When I build a csv-file with Microsoft Excel it is ";"-seperated and without quotes.

 

How can I export my whole RadGridView with ","-seperated words that are without quotes?

 

Dinko | Tech Support Engineer
Telerik team
 answered on 16 Aug 2019
3 answers
255 views

I'm adding a system generated paragraph with 3-4 lines to the end of every XAML document on the server side and I want to make sure that these lines are always on the same page. Either they all fit or they should be moved to the next page.
I’ve tried to detect this overlap by checking number of pages before and after this addition via DocumentLayoutBox, but PageNumber of last ChildLayoutBoxes is not changing.
Additionally, it would be nice to have a feature to allow paragraph alignment to the bottom of the page.

 

Regards,

Vitalij

Boby
Telerik team
 answered on 16 Aug 2019
6 answers
2.7K+ views
Hi

I'm currently testing the UI for WPF and there's one problem I can't seem to solve. I wrote a small APF application using the Windows8-Theme. I change some Fonts, Font sizes and Colors of the palette and apply it as my application theme in the Code Behind.

Now I've got a TreeView where I'm dynamically adding children. This works as intended so far, but when an item in the TreeView is selected, the background color of the Selection-Border is blue (which is fine) but the font color is still black, which makes the name of the selected item hard to read.

So I tried to change the Foreground-Property of the currently selected item. There are two ways I tried out yet. First, I tried to change the style via XML by binding a style with a trigger to the ItemContainerStyle property of the TreeView, like this:

<telerik:RadTreeView ItemContainerStyle="{StaticResource SelectedTreeViewItem}" x:Name="TreeViewDomain">

And this is the Resource for the style:

<Style x:Key="SelectedTreeViewItem" TargetType="{x:Type telerik:RadTreeViewItem}">
      <Style.Triggers>
          <Trigger Property="IsSelected" Value="true">
              <Setter Property="Foreground" Value="White"/>
          </Trigger>
      </Style.Triggers>
</Style>

It kind of does the job but only kind of, because it also changes the Foreground color of all child elements of the selected item. I don't know if I did anything wrong there or if forgot something (I'm still fairly new to WPF) but this is not the behavior I expected.

I tried another approach: good old event driven Code Behind. Just change the Foreground color of the sender when the PreviewSelected event fired:

void __childItem_PreviewSelected(object sender, Telerik.Windows.RadRoutedEventArgs e)
{
    var __currentNode = (RadTreeViewItem) sender;
    __currentNode.Foreground = Brushes.White;
}

But same problem here: the Font color of the selected item changes, but so does the font color of all child items. I first thought this had something to do with event routing but that seems not to be the case. Since I'm adding children dynamically with Code Behind, I tried changing the Foreground color first and then added the child nodes but with the same result. They somehow seem to inherit the Foreground color of the parent.

Now I know that since I'm using the Windows8 Theme that I could make a local copy of the Theme-XAML, reference this one instead of the standard ones in the GAC from Telerik and change the color directly there. But I'm still curious as to why the control is behaving in they way I'm experiencing it in this case.

Any suggestions?

Regards,
Steve.
Martin Ivanov
Telerik team
 answered on 16 Aug 2019
3 answers
219 views

Hi there! 
i have RadGrid that i want it to be edited by user in run time which allows him to delete ,insert,and update then i have to perform this changes on the entity database so how can i do this 
how can i insert new row and get the data that inserted in each field on it
how can i get the updates

i tried this code but it returns the old data not the new one which i add by editting

 foreach (GridDataItem editedItem in RadGrid1.Items)
                {
                    Hashtable newValues = new Hashtable();
                    //The GridTableView will fill the values from all editable columns in the hash
                   int i=int.Parse( editedItem.GetDataKeyValue("id").ToString());
                   editedItem.ExtractValues(newValues);
                   akaratCBContext conn = new akaratCBContext();
                   Product p = conn.Products.Where(prd => prd.id == i).FirstOrDefault();
                  p.ProductName= newValues["ProductName"].ToString();
                  p.Description= newValues["Description"].ToString();}

Dilyan Traykov
Telerik team
 answered on 16 Aug 2019
7 answers
892 views
I have a grid view with editable text box and a button ("PRINT")  in it (with data binding).
When I edit a text in the text box and then press the button the text in the text box doesn't get updated , the text box doesn't lose focus on the button click...
So for example : when the form loaded the text box contains text "AAA". I click on the text box and start changing the text to "BBB", then (without diselecting the text box) I click "PRINT" button  - the printed value would be "AAA" and not "BBB"


<telerik:GridViewDataColumn  DataMemberBinding="{Binding LabelToPrint, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"   Header="label " IsReadOnlyBinding="{Binding IsLabelReadOnly}" EditTriggers="CellClick" >
                                </telerik:GridViewDataColumn>
                                <telerik:GridViewColumn Header="Print Label" FocusManager.FocusedElement="BagGridView">
                                    <telerik:GridViewColumn.CellTemplate>
                                        <DataTemplate>
                                            <telerik:RadButton Content="Print Label"  Command="{Binding DataContext.PrintLabelCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:RadGridView}, AncestorLevel=2}}" CommandParameter="{Binding}"/>
                                        </DataTemplate>
                                    </telerik:GridViewColumn.CellTemplate>
                                </telerik:GridViewColumn>
Martin Ivanov
Telerik team
 answered on 15 Aug 2019
1 answer
114 views

Hi,

 

I have created a plugin which contains a dialog which should host a RadRichTextBox. But the RichTextBox will not be displayed.

This plugin will be in registered via MEF.

 

I used your workaround which will be called by the contructor of the dialog:

 private void InitMEFCatalog()
        {
            RadCompositionInitializer.Catalog = new TypeCatalog(
            // format providers
            typeof(HtmlFormatProvider),
            typeof(RtfFormatProvider),
            typeof(DocxFormatProvider),
            typeof(PdfFormatProvider),
            typeof(HtmlFormatProvider),
            typeof(TxtFormatProvider),
            
            // mini toolbars
            typeof(SelectionMiniToolBar),
            typeof(ImageMiniToolBar),
            
            // context menu
            typeof(Telerik.Windows.Controls.RichTextBoxUI.ContextMenu),
            
            //// the default English spellchecking dictionary
            //typeof(RadEn_USDictionary),
            
            // dialogs
            typeof(AddNewBibliographicSourceDialog),
            typeof(ChangeEditingPermissionsDialog),
            typeof(EditCustomDictionaryDialog),
            typeof(FindReplaceDialog),
            typeof(FloatingBlockPropertiesDialog),
            typeof(FontPropertiesDialog),
            typeof(ImageEditorDialog),
            typeof(InsertCaptionDialog),
            typeof(InsertCrossReferenceWindow),
            typeof(InsertDateTimeDialog),
            typeof(InsertTableDialog),
            typeof(InsertTableOfContentsDialog),
            typeof(ManageBibliographicSourcesDialog),
            typeof(ManageBookmarksDialog),
            typeof(ManageStylesDialog),
            typeof(NotesDialog),
            typeof(ProtectDocumentDialog),
            typeof(RadInsertHyperlinkDialog),
            typeof(RadInsertSymbolDialog),
            typeof(RadParagraphPropertiesDialog),
            typeof(SetNumberingValueDialog),
            typeof(SpellCheckingDialog),
            typeof(StyleFormattingPropertiesDialog),
            typeof(TableBordersDialog),
            typeof(TablePropertiesDialog),
            typeof(TabStopsPropertiesDialog),
            typeof(UnprotectDocumentDialog),
            typeof(WatermarkSettingsDialog));
        }

 

My output window looks like that:

"Configurator.exe" (CLR v4.0.30319: Configurator.exe): "C:\Users\Didi\Source\Repos\cc360main\Configurator\bin\Debug\Telerik.Windows.Documents.dll" geladen.
"Configurator.exe" (CLR v4.0.30319: Configurator.exe): "C:\Users\Didi\Source\Repos\cc360main\Configurator\bin\Debug\Telerik.Windows.Documents.Core.dll" geladen.
"Configurator.exe" (CLR v4.0.30319: Configurator.exe): "C:\Users\Didi\Source\Repos\cc360main\Configurator\bin\Debug\Telerik.Windows.Documents.Flow.dll" geladen.
"Configurator.exe" (CLR v4.0.30319: Configurator.exe): "C:\Users\Didi\Source\Repos\cc360main\Configurator\bin\Debug\Telerik.Windows.Documents.Flow.FormatProviders.Pdf.dll" geladen.
"Configurator.exe" (CLR v4.0.30319: Configurator.exe): "C:\Users\Didi\Source\Repos\cc360main\Configurator\bin\Debug\Telerik.Windows.Controls.RichTextBoxUI.dll" geladen.
"Configurator.exe" (CLR v4.0.30319: Configurator.exe): "C:\Users\Didi\Source\Repos\cc360main\Configurator\bin\Debug\Telerik.Windows.Controls.Navigation.dll" geladen.
"Configurator.exe" (CLR v4.0.30319: Configurator.exe): "C:\Users\Didi\Source\Repos\cc360main\Configurator\bin\Debug\Telerik.Windows.Controls.dll" geladen.
"Configurator.exe" (CLR v4.0.30319: Configurator.exe): "C:\Users\Didi\Source\Repos\cc360main\Configurator\bin\Debug\Telerik.Windows.Controls.RibbonView.dll" geladen.
"Configurator.exe" (CLR v4.0.30319: Configurator.exe): "C:\Users\Didi\Source\Repos\cc360main\Configurator\bin\Debug\Telerik.Windows.Controls.Input.dll" geladen.
"Configurator.exe" (CLR v4.0.30319: Configurator.exe): "C:\Users\Didi\Source\Repos\cc360main\Configurator\bin\Debug\de\Telerik.Windows.Controls.resources.dll" geladen. Das Modul wurde ohne Symbole erstellt.
"Configurator.exe" (CLR v4.0.30319: Configurator.exe): "C:\Users\Didi\Source\Repos\cc360main\Configurator\bin\Debug\Telerik.Windows.Documents.FormatProviders.OpenXml.dll" geladen.
"Configurator.exe" (CLR v4.0.30319: Configurator.exe): "C:\Users\Didi\Source\Repos\cc360main\Configurator\bin\Debug\Telerik.Windows.Zip.dll" geladen.

 

As you can see, there is no error.

 

My xaml code:

   <Grid Grid.Row="2">
            <telerik:RadRichTextBox
                x:Name="richTextBoxAdv"
                IsSpellCheckingEnabled="False"
                LayoutMode="Paged" />
        </Grid>

The height of Grid.Row 2 is *.

 

Any ideas?

Peshito
Telerik team
 answered on 15 Aug 2019
2 answers
215 views

Hi Team,

 

I want to change the RadRichTextBox content(remove some invalid characters) in LostFocus event. Initially, i have loaded the RadRichTextBox with some header and footer content. Then, i am entering some data(Paste data also) and tabout. While losing the focus, need to remove some invalid character and save in the same document. I have tried like below. 

 

           Telerik.Windows.Documents.FormatProviders.Txt.TxtFormatProvider provider = new Telerik.Windows.Documents.FormatProviders.Txt.TxtFormatProvider();
           string output = provider.Export(richtextbox.Document);   // getting textbox's text     
           string text = output;
                foreach (char letter in text)
                {                  
                            if (//Condition)
                            {  
                              // here remove some invalid characters based on some condition.
                                output = output.Remove(index, 1);                                
                            }                
                }                                      
              RadDocument document = new RadDocument();
              document = provider.Import(output);         

              radRichTextBox.Document = document;  // update the document .. It is an error

              object Docx = docprovider.Export(document); // DocxFormatProvider

 

After removing the some content, document's header and footer also removed. Can you please suggest how to edit the content of RadRichTextBox ?

 

Martin
Telerik team
 answered on 15 Aug 2019
7 answers
242 views
We are using the WPF RadCalendar to show two months side by side. We have ViewsHeaderVisibility set to Visible so that the individual month header is displayed on each calendar. The default header top bar is still displayed spanning both calendars with the first month as the title. What we want to do is hide the default header as it is confusing to have the month displayed twice. Is there an easy way to do this?
Dilyan Traykov
Telerik team
 answered on 15 Aug 2019
4 answers
1.1K+ views

Hi!

I'm using WPF RadComboBox in an application and run the application on a Lenovo ThinkPad. It has touch screen and runs Windows 10 Enterprise.

When I have many items in my RadComboBox and scroll through them on the touch screen, the scroll is much too fast - it scrolls too many items at the time.

I installed the WPF Controls Demo and got the same result, though not as apparent since the example doesn't contains as many items.

Have you experienced the same problem? Is there any way I can "slow down" the scroll?

If I use a regular WPF ComboBox instead of the RadComboBox, I don't have this problem. But I'd really prefer to use the RadComboBox if possible =)

Best Regards!

Stefan
Top achievements
Rank 1
 answered on 15 Aug 2019
7 answers
239 views

In reference to: https://www.telerik.com/blogs/how-to-boost-radgridview-performance-for-wpf-and-silverlight-using-lightweight-templates

 

I just discovered your new TELERIK COLOR THEME GENERATOR. (very cool by the way :-)

1) Are the "CHOOSE THEME" items the lightweight templates ?

2) If the answer to 1) is yes, will modifying anything in the tool increase the "weight" ?

3)The "Office2016Touch" template is almost a perfect match to our current color scheme, so we'd likely go with that...is it "lightweight" ?

 

Thanks in advance,

Barry

Martin Ivanov
Telerik team
 answered on 14 Aug 2019
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?