How could I set or change the style of windows default controls(Like button,textbox etc.) using the DevExpress themes/skins?
Application: Windows
Framework: .NET Framework 4.0
DevExpress WinForms Version: 14.2
Devexpress doesn't supports skinning of regular winforms controls. You need to use their own controls to get the application skinned/themed.
For TextBox you use TextEdit, for Button you use SimpleButton and so on.
But you can read the skin element colors at runtime and apply yourself.
Sample code from the above link(in case link rot in future):
DevExpress.Skins.Skin currentSkin;
DevExpress.Skins.SkinElement element;
string elementName;
currentSkin = DevExpress.Skins.CommonSkins.GetSkin(defaultLookAndFeel1.LookAndFeel);
elementName = DevExpress.Skins.CommonSkins.SkinTextBorder;
element = currentSkin[elementName];
Color skinBorderColor = element.Border.All;
Related
I have created my own custom control in WinRT, which has own template for it. My custom control contains many inner custom elements(Small Controls) which are also having own templates.
Then i tried to provided the designer edit facility in Visual Studio for all that templates by StyleTypedProperty attribute and it results fail to me. In designer,EditTemplate working fine for my Control but EditAdditionalTemplates does not contain the templates of inner elements of my control.
NOTE: Same working fine in WPF designer.
Any one faced this kind of issue or please provide some suggestions?
[StyleTypedProperty(Property = "PopupStyle", StyleTargetType = typeof(Popup))]
public class MyControl : Control
{
}
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.
Windows Workflow Foundation 4 contains a WPF property grid similar to the one available for Winforms. The toolbar up the top has a CLEAR button rather than the X shown by Visual Studio. This control has a ControlTemplate property that is not null at runtime. The template makes use of various glyphs for toolbar buttons.
Are there any tools or techniques that will allow me to extract this template? I would like to examine and modify the XAML to restyle the toolbar (mostly just change the button label).
I have programmatic access to the template object but I'm not sure how to serialize this into XAML.
Have you tried simply using XamlWriter.Save?
e.g.
var template = control.Template;
using (var stream = new FileStream("template.xaml", FileMode.Create))
{
using (var writer = XmlWriter.Create(stream, new XmlWriterSettings() { Indent = true }))
{
XamlWriter.Save(template, writer);
}
}
have you tried Red Gate's Reflector? Of course, if the assembly is obfuscated it may not really be of much help.
In .net Compact Framework 2.0, you could add a form to another forms control array basically parenting the other form.
i.e._mainForm.Controls.Add(form);
This is not allowed in .net cf 3.5 and results in an exception:
System.ArgumentException: Value does not fall within the expected range.
at Microsoft.AGL.Common.MISC.HandleAr(PAL_ERROR ar)
at System.Windows.Forms.Control._SetParent(Control ctlParent)
at System.Windows.Forms.Control.set_Parent(Control value)
Is there a workaround or alternative for this? I need to be able to parent a form inside a panel on another form.
I think this contains answer to your question: http://207.46.16.248/en-us/netframework/bb986636.aspx
especially this part:
System.Windows.Forms.Form.Parent
Description
Forms can no longer be parented.
Previous Behavior
In .NET Compact Framework 1.0, forms could be parented to any other control
that supported child controls. In .NET Compact Framework 2.0, forms
could be parented to any other form.
New Behavior
In the .NET Compact
Framework version 3.5, forms cannot be parented.
You can use the following method to copy form controls to another form in .NET CF 3.5
// Clear old form controls
oldform.Controls.Clear();
// Copy controls from newform to oldform
foreach (Control ctl in newform.Controls)
{
oldform.Controls.Add(ctl);
}
I have an application I'm developing which closely mirrors Windows 7's Device Stage. In Device Stage, beneath the main banner there is a ListView containing actions embodied as ListViewItems.
In my WPF application, I used WindowsFormsHost to host a WinForms ListView so that I could use SetWindowTheme() on it and apply Windows Vista/7 styling to it.
This, however, does not work and doesn't achieve the same effect it does when used in Windows Forms.
How can I achieve the Windows 7 look on a ListView in WPF? I'm not looking to create a custom style then apply it because frankly that's too much of a pain in the ass to continue using WPF for this app.
Thanks! :)
Just add the following lines:
[DllImport("uxtheme.dll", CharSet = CharSet.Unicode)]
public static extern int SetWindowTheme(IntPtr hWnd, String pszSubAppName, String pszSubIdList);
.ctor
{
System.Windows.Forms.Integration.WindowsFormsHost.EnableWindowsFormsInterop();
System.Windows.Forms.Application.EnableVisualStyles();
SetWindowTheme(MyControl.Handle, "Explorer", null);
}
Apparently after digging around, the only answer does indeed appear to be creating a custom-designed control in WPF.