I am using Telerik Richtexbox version- 2012.2.607.1040 for Silverlight . I am displaying word documents in the text box using DocxFormatProvider . I wanted to know if it is possible to add watermark to every page displayed in the textbox programatically so that I dont have to insert watermark in each individual document from MS word . The richtext box doesn't support watermark natively and the only way is by adding a custom layer according to the telerik support .
With the present-day versions of Telerik UI for Silverlight controls, this feature is natively supported by RadRichTextBox:
WatermarkTextSettings textSettings = new WatermarkTextSettings();
textSettings.Text = "Purple Watermark";
textSettings.RotateAngle = 30;
textSettings.Opacity = 1;
textSettings.ForegroundColor = Colors.Purple;
this.radRichTextBox.SetWatermarkText(textSettings);
There is detailed help article in the Telerik's UI for Silverlight documentation.
Related
I have set two different cultures to the thread as:
Thread.CurrentThread.CurrentCulture = "fi-FI"
Thread.CurrentThread.CurrentUICulture = "en-Us"
But the calender text is shown in Finnish culture.
I need to keep the Text(Translations) based on CurrentUICulture and Text Format based on CurrentCulture.
Can you please suggest how can it be done for it?
That is not possible. The Calendar control only reacts to the CurrentCulture value. CurrentUICulture is used by the ResourceManager to load up different strings, images etc. used in the UI, but that is not where the day/month names are stored. They are part of the .NET framework itself. To get the functionality you want you will have to write your own implementation of the DatePicker and/or TimePicker controls. Perhaps you could download the code for the Silverlight Toolkit and use that as a base for your own implementation. What you are looking for is basically a way of overriding the names of months and days manually. Maybe it is even possible to extend the controls and add that functionality on top, but I doubt it.
I have below sample code for my wpf app.
I need to fill in text fields of form with strings.
Run('AutoItWpfTesting.exe')
WinWaitActive("Window1", "")
$hHwnd = WinGetHandle("Window1")
MsgBox(0, "Message", $hHwnd)
$returnVal1=ControlGetHandle ( "$hHwnd", "", "[NAME:txtVersion]")
$returnVal2=ControlSend($hHwnd,"","[NAME:txtVersion]","blahblah")
MsgBox(0, "Message", $returnVal2)
it returns 0 for $returnVal2 and Empty string for $returnValue1.
However this works fine for my sample winform application.
Any clues why this behaviour is..and Any tweaks available to get exact text-box to auto fill data for wpfa app.
WPF applications do not use Windows' controls and handles for the controls. You can see that by using Spy++. WPF Alternatives for Spy++
If you want to automate WPF applications you will need another tool or use the UI Automation API to build one.
My windows forms application hosts AvalonEdit (the composite WPF control in question) in one of its forms to cater to its text editing requirements. Here's the code I use:
WPFHost = gcnew ElementHost();
TextField = gcnew AvalonEdit::TextEditor();
WPFHost->Dock = DockStyle::Fill;
WPFHost->Child = TextField;
TextField->Options->AllowScrollBelowDocument = false;
TextField->Options->EnableEmailHyperlinks = false;
TextField->Options->EnableHyperlinks = true;
TextField->Options->RequireControlModifierForHyperlinkClick = true;
TextField->ShowLineNumbers = true;
ContainerControl->Controls->Add(WPFHost); // the container is a panel
The code compiles and executes fine, except for the scrollbars - http://dl.dropbox.com/u/2584752/avalonEditBug.png . Right clicking on what's left of the bar raises an ArgumentOutOfRange exception.
Strangely, I wasn't able to reproduce the issue when I tried hosting the control in a newly created sample project. 'mI using the latest build of the text editor and have all the requisite assemblies installed.
EDIT: Wrapping the editor in a usercontrol doesn't help either.
You say that the control works fine in a new/blank project but fails in the one you need makes me wonder about conflicts more than anything. In the project you're really wanting compared to the project it worked in what are the differences? .NET version? Referencing an assembly from a directory in one but out of the GAC in another?
It's hard to say that the control is messing up for you when you've got it working elsewhere, so the only thing I can suggest is just dive deep into the differences of the two projects.
Good luck.
This looks like a layout error to me. Maybe WPFHost measures the TextField unexpectedly.
I can suggest setting specific Width and Height on the TextField itself. If this fixes the problem you can adjust those as the size of the WPFHost control changes or try setting the MaxHeight/Width, sometimes they help and save some code for Width/Height updates.
try to create a WPF grid as a child of ElementHost, and place the editor inside that grid. On Other way, is to create an UserControl have the editor in that control and use the control inside your Winform app. Such approach helped me a couple of times.
I've implemented a workaround for the issue as mentioned in this thread [ Synchronizing a WPF ScrollViewer with a WinForms ScrollBar ].
I am building a PDF Viewer using the Atalasoft DotImage libraries. They have a PDF Viewing component, but it doesn't support the Acrobat style PDF continuous layout, I have to display the pages a page at a time.
I need to build sort of a virtualizing scrollable control which has probably 3 PDFViewers in it, the current frame, and the ones immediately before and after. So my question is - how would I do this?
[I've been doing WPF for the last 3 years, and my WinForms experience has turned to mental mush.]
I need to be able to detect which viewers to open, and which to close. How?
You can do this with a Panel. Set AutoScroll = true and AutoScrollMinSize.Height = pages x control.Height. Implement the Scroll event handler and look at the -AutoScrollPosition.Y property to find out what the user is looking at. Change the Location property of the 3 controls and their Page property as necessary.
I'm looking for a reporting/printing solution that does not involve RDLC/SSRS. I'd like to use the DocumentViewer, which I know supports XPS. I have found plenty of examples that use Visual to XPS but I haven't found many examples where I can take an existing WPF page, with various controls like labels, listboxes, grids, etc and create that into an XPS document. Is there a code example out there that takes an entire XAML page and creates XPS?
It's not trivial, the basic problem here is that XPS represent fixed pages. An existing WPF page does not necessarily translate to pages on a document. How will your report be split if it cannot fit the page? This information is needed.
What you can do is to create the report as a FlowDocument (see http://msdn.microsoft.com/en-us/library/aa970909.aspx). This will give the .NET framework enough info on how to paginate your report such that when you do this:
FlowDocument flowDocument;
// load, populate your flowDocument here
XpsDocument xpsDocument = new XpsDocument("filename.xps", FileAccess.ReadWrite);
XpsDocumentWriter writer = XpsDocument.CreateXpsDocumentWriter(xpsDocument);
writer.Write(((IDocumentPaginatorSource)flowDocument).DocumentPaginator);
it works. (Code lifted from Pro WPF in C# Book).
Usually your WPF page has a root UI element, say Grid. As Grid is a specific type of Visual(please vide "Inheritance Hierarchy" part #http://msdn.microsoft.com/en-us/library/system.windows.controls.grid.aspx for more details), you just need to write that root Grid element like other visuals into XPS. And then all embedded controls will be automatically written into XPS document.