I'm using Microsoft Report Viewer in windows application and its datasource
is a custom class object. I have several Text fields and some are in different formats
(ie size of the font, underline, bold....) but several are grouped.
For these reason I would like to use a CSS (Cascading Style Sheet) class or some thing similar for formatting. (now I formatting each controls manually).
Is there a way to do this?
No, there is no way to do this. RDL, and all of the tools built around it (like ReportBuilder, BIDS, etc) have no concept of stylesheets of any kind.
The best solution is to select all the textboxes at once that you want all to be the same, then edit their properties in the property grid (in BIDS, Visual Studio or ReportBuilder). If you instead edit their properties through the property dialog, you must do it one at a time.
Probably the best you can do is to use expression parameters when you set the Font.
e.g. define report pararameter #FontSize and set default to 10
This allows you to override your default font size when you request the report by setting the report parameter.
I don't believe you can use CSS for a desktop windows application, your best bet is to look at the custom formatting for each cell of the ReportViewer
Related
I am trying to create a styled h4.
But my h4 keeps inheriting from some user agent?
What is this user agent.
How can I stop it from doing so. Its adding effects that I dont want.
No, the h4 element (or the h2 element, as in your screen shot) does not inherit from some user agent. Instead, it gets property values directly from a user agent stylesheet. “User agent” means a browser in practice (in principle, it could be an indexing robot, too, for example).
You can stop that simply by assigning properties in your style sheet. In fact, you have done that in your example: font-size and font-weight have been overridden. The setting display: block could be overridden e.g. by adding display: inline into your style sheet.
The margin issue is trickier, as WebKit browsers have their oddities there, and the -webkit-margin properties are shown as if they had not been overridden. But in fact they are ignored when the standard margin properties are set, as they are in your case; check out the “Metrics” pane to see this.
So you are already overriding the user agent style sheet settings. In general, a user agent style sheet could contain anything, but using a reset.css style sheet is still a wrong approach mostly. The default style sheet for HTML 4 in the CSS 2.1 spec is fairly realistic and tells you what to prepare for, e.g. display, margin, font-weight, and font-size for headings.
To stop the inheriting from the user agent (styles your web browser chooses by default for various HTML elements) madness you need to use a good CSS "reset".
Read http://meyerweb.com/eric/tools/css/reset/ for an intro into a "reset".
A list of different "resets" http://www.cssreset.com/
Also if you are using some framework like Twitter Bootstrap for example it will already have a reasonable reset included.
We are developing a localized English/Arabic application, and I need to set the System.Threading.Thread.CurrentThread.CurrentUiCulture to either of both cultures during design time to a different value than the value set at run time.
How can I accomplish this?
Thanks in advance.
Set the xml:lang attribute.
This attribute describes the culture of a specific element and its child elements. The value of this property changes the behavior of several features in WPF. For example, it changes the behavior of hyphenation, spell checking, number substitution, complex script shaping, and font fallback. See Globalization for WPF for more information about setting the xml:lang Handling in XAML.
http://msdn.microsoft.com/en-us/library/ms788718.aspx
Check this out http://geekswithblogs.net/lbugnion/archive/2009/09/05/detecting-design-time-mode-in-wpf-and-silverlight.aspx, you can then set the Language accordingly with something like
FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.Name)));
The WPF Localization Extension allows you to set design time language (and it has other features, like allowing you to change languages at runtime through WPF with no code-behind etc.).
Check it out here: http://wpflocalizeextension.codeplex.com/
It is possible to export Microsoft Visio drawings as a Website containing Silverlight content. This is described on this blog-post.
The output of such an export are the following:
xaml_1.xaml (contains the structure of the control)
data.xml (contains all text content such as labels, etc)
several java-script files
*.htm pages with a Silverlight container
other files such as *.css and images
I would like to integrate the exported XAML code into another existing Silverlight application. I found this blog-post telling me how to load XAML code dynamically during runtime.
What I would like to know is how to "merge" the XAML-file and the data.xml and how I can get a reference to the items of the XAML code, in order to change certain texts...
In the associated xaml js file (eg xaml_1.js) there's a handleMouseUp function that reads the shape ID from the (XAML) 'name' string and then calls OnShapeClick in frameset.js. This method, which is common to all of the js-based Save as web output types, then calls other methods to populate the details table or retrieve hyperlinks found in data.xml. If you have a look at the FindShapeXML function in frameset.js you'll see that it gets the appropriate data based on the page and shape IDs (note that shape IDs are unique to a page as per Visio itself).
In terms of creating data-bound or dynamic shape text, one workaround for the glyphs issue that #slfan highlights is prevent the text from being output. For example, prior to running Save As Web in Visio, you could loop through all of the shapes and set their HideText ShapeSheet cell to true. This will prevent all of the glyphs xaml being generated and you'll still have access to the text string in data.xml. I guess you wouldn't then benefit from the correct font scaling, but it depends on your scenario. If it was really important to get the scale right then you could parse the RenderTransform attribute (which is described in attribute syntax rather than property element syntax) of the glyph elements.
Glyphs are there (I'm guessing) because it mirrors how Visio works in the application ie in Visio you can select individual characters within a shape's text and apply different fonts and formatting, but if you don't need that, I'd be tempted to ditch the glyphs collection and just use a TextBlock as #slfan suggests.
I think you have to tweak the generated XAML a little bit. Unfortunately Visio generates glyphs for every single character. If you want to change the text at runtime, you will have to remove this glyphs and add the required controls (e.g. TextBlock) yourself.
You can load the XAML into Silverlight with XamlReader.Load. A good description you find here: http://blogs.silverlight.net/blogs/msnow/archive/2008/10/09/silverlight-tip-of-the-day-60-how-to-load-a-control-straight-from-xaml.aspx.
All JavaScript and HTML files you can ignore, the XML-file you need to identify your controls. The ID's in the XML refer to the corresponding elements in the XAML-file.
I have a large number of forms with a lot of controls on them and i need to do specific actions with certain groups of controls. Is it possible to select all elements with the same type using vs winforms designer? or using other instruments?
It's not a problem when i'm using custom controls where i can implement my own controlDesigner and override Verbs property (for example), but unfortunately most of them are common.
"I need to do specific actions with certain groups of controls" is pretty vague. If you are trying to change or insert a property to controls with a specific name or property value, you could try a global search and replace of the form.designer.cs files. Depending on what you're changing, this will be used by, overwritten by, or completely break the designer.
If you want a better answer you will have to describe what you're trying to do.
Visual Studio QuickWatch window has a hierarchical property grid control. Is a control like that available somewhere?
The default property grid control doesn't seem to work for me as it requires the objects to have an ExpandableConverter attribute to work the way I want. Although, if any of you know a way to turn the property grid into a QuickWatch-like control it would also be accepted.
Thanks.
It is very spread type of control. Each Library-of-Controls company created at least one.
http://images.google.com.ua/images?q=tree%20like%20grid
Here you have two samples:
http://www.codeproject.com/KB/grid/PropertyGridExWinForms.aspx
http://www.howtocode.net/software-development/c/propertygrid-utilities
I don't think so, its something you would have to create your self.
looks like it wouldn't be to difficult, I think its DataGridView where the first column is a custom cell that when clicked does a hit test to see if its hit a node glyph.
But i could be wrong.