I have a "problem" with the text scaling setting (All settings -> Ease of Access -> More options). It increases the text size and creak my design. For example, texts of my menu are cut.
So, I have two questions:
In applications developed by Microsoft, this particularity is "ignored" and text sizes is always the same (eg: News, Sports, Weather, ...) but how to do it?
If Microsoft uses very bad practices in the previous point, what is the best way to manage this settings.
Thanks
If you do not want the text automatically scales according to the system text size setting, you can set IsTextScaleFactorEnabled property to false. This property indicates whether automatic text enlargement is enabled to reflect the system text size setting and by default, its value is true. For example, in TextBlock, use it like following:
<TextBlock FontSize="20" IsTextScaleFactorEnabled="False">Test</TextBlock>
Other than TextBlock, there is a lot of other types have an IsTextScaleFactorEnabled property. And we can also use the TextScaleFactorChanged event and the TextScaleFactor property to find out about changes to the Text size setting on the phone.
For more info, please see Text scale factor in Accessible text requirements.
Related
I am building a wpf user control to provide navigation facilities for database records.
The control is provided with a set of default images (as illustrated above) which the end user can change is they so wish. In addition the end user can choose to dispense with images altogether. In the event that they select that option (for either one or all of the buttons that comprise the control) I have provided some default fallback text.
This text can also be overwritten by the end user if they so wish, but the default text at least provides them with some basic text that essentially conveys what the button does and saves them having to add text every time they use the control (default tooltip text is also provided).
Now if you happen to speak English, or your intended target audience is English this should work, but it doesn't really cater as is for languages other than English. This I would now like to change.
What reading I've done on the subject of multi-lingual resources and wpf seems to assume that one is talking about the overall application rather than a standalone user control that might be used in different language environments.
I had a talk with a creator of controls who said that making this multilingual would probably involve building several copies of the control for each intended language.
In the light of this I have two questions. Was the gentleman I spoke to correct, should I in fact build multiple copies of this for each language, of is there a way to have multi-language resources within the same copy of the user control?
If the latter is possible what is the correct way to go about achieving this. We will be dealing in total with default texts for eleven buttons (which I will need to be able to refer to in code within the control incidentally) and default texts for thirteen tooltips (which again will need to be able to be referred to within the code of the control).
Take a look on WPF localization extension.
Here's a pretty good documentation for it: link.
You can define your controls' localizable properties, which store their localized values in the satellite resource assemblies.
In your xaml code, define the localized properties with xaml extensions syntax:
<Button Content="{lex:Loc Test}" />
Then, create resource files for each culture your application will support and give them the same name as the main assembly plus the general or specific culture code (e.g. en-US, de, de-AT, ...) before the .resx ending yielding: AssemblyName.CultureCode.resx.
Now, populate the resource files with your localized properties key/value pairs and build the project.
You're done!
We have a Silverlight application with a RadRibbonBar at the top. The user can collapse it (not Visibility.Collapse) to just the menus with a double-click.
The IsCollapsed property is ReadOnly, but we need to retain the user preferences across runs of the app.
How do you programmatically set the IsCollapsed state of a RadRibbonBar?
Result
Silly me (and shows that the documentation is a little hard to find/follow). I had to google "RadRibbonBar IsMinimised" to find the actual page: http://www.telerik.com/help/silverlight/telerik.windows.controls.ribbonbar-telerik.windows.controls.radribbonbar-isminimized.html
Thanks to Stephen McDaniel for pointing out my error.
I think you might be confusing "Collapsing" a RibbonBar with the idea of "Minimizing" it.
Collapsing is something the RibbonBar does automatically when the window gets very small - which is why it's ready-only. From the documentation:
RadRibbonBar supports collapsing, which means that the ribbon may
automatically collapse to save space when the application is resized
to a smaller size.
But what you are describing (double clicking to get just the menu) is called Minimizing. From the documentation:
RadRibbonBar supports minimization, which means that the ribbon may be
hidden so that only its tab headers remain visible. In this state,
more screen real estate is available to the client area of the window.
And luckily, controlling Minimization via code is very easy. You can use the IsMinimized property:
IsMinimized - use this property to set or get the current minimize
state of the ribbon.
So you should be using the IsMinimized property instead of IsCollapsed.
You can check out the documentation links I provided above for more information.
I'm creating a program where the width of column needs to be relatively narrow, but when I add a combo box I have to increase the width so that I can read the listings in the drop down. I know that in HTML the drop down adjust to the length of longest entry, in Iron Python you can adjust the drop down width manually, but I can't seem to find any reference to either of these options in PyQt. If I'm missing it in the documentation, a friendly pointer to the right spot would be of great help. Thanks.
The dropdown portion is a component that inherits QAbstractItemView (usually QListView).
It is accessible via the view() getter of the QComboBox. You can play with its sizePolicy to get what you want.
If it is not satisfying, you can even set your own QAbstraItemView to the QComboBox via `setView'.
In Qt a widgets size is usually controlled by its layout. The layout management docs should help. In particular, take a look at QSizePolicy. If you're using designer, you can set these directly as properties, otherwise you'll need to do it in code. The basic layouts example may help as well.
I have a RichTextBox and need to serialize its content to my database purely for storage purposes. It would appear that I have a choice between serializing as XAML or as RTF, and am wondering if there are any advantages to serializing to XAML over RTF, which I would consider as more "standard".
In particular, am I losing any capability by serializing to RTF instead of XAML? I understand XAML supports custom classes inside the FlowDocument, but I'm not currently using any custom classes (though the potential for extensibility might be enough reason to use XAML).
Update: I ended up going with RTF because of its support for text-encoded embedded images. XAML doesn't seem to include image data in its encoding, and XamlPackage encodes to binary, so RTF just works better for me. So far I haven't noticed any lack in capability.
If all your users are doing is typing in the RichTextBox and doing character formatting, RTF is as good as XAML. However there are many FlowDocument capabilities you may expose in your UI that are not convertible to RTF.
Here are some examples of FlowDocument (and RichTextBox) features that are not expressable in RTF or are implemented differently:
A Block can have an arbitrary BorderBrush, including gradient brushes with stops, VisualBrush
A Section has the HasTrailingParagraphBreakOnPaste property
Floater / ClearFloaters is implemented differently
Hyphenation can be enabled/disabled per block, not just per paragraph
WPF Styles and ResourceDictionaries can be included in the Resources property
Arbitrary WPF UI such as bound CheckBoxes, etc, can be embedded inside the RichTextBox and can be cut-and-pasted from other windows.
For example, suppose you want to allow users to drag or cut/paste in a "current date/time" field into your RichTextBox that would always show the current date and time. This could be done by adding a second read-only RichTextBox that has the InlineUIContainer and the already-bound control. This even works when cutting and pasting from other applications and does not require custom controls.
Another consideration is that the code to convert between FlowDocument and RTF is relatively complex so it may have lower performance than going with XAML. Of course loose XAML doesn't include images and such - for that you need to use XamlPackage. I store my XamlPackage in the database as a byte[], but you can also choose to Base64 encode it for storage as a string.
The bottom line is that it really depends on whether you want the user to be able to use features not available in RTF. Even if your application doesn't include tools to generate FlowDocuments that use these features, it is possible to cut-and-paste them from other applications.
Be aware that in Wpf RichTextBox's method called TextRange.Save has a bug whereby it loses any end of line terminator. Microsoft will not fix.
https://connect.microsoft.com/WPF/feedback/ViewFeedback.aspx?FeedbackID=478640&wa=wsignin1.0#tabs
I have a list that the user can filter in several ways. two of which lend themselves to combo boxes and two that need to accept user input. For example, one textbox allows the user to type in any part of a list item's description, and the dialog will only present items whose description contains the text entered.
It is a dialog 'picker' type of window, so space is at a premium. I'd like for the text boxes not to require a traditional label. Instead, when the dialog is first invoked, the label (ie, "Description") is grayed out, centered, and in italics. Maybe a tool tip to further make it obvious to the user what it's for. When the user starts to type, the faux label disappears and the entered text is normal left aligned text.
Does wpf / silverlight have any native support for doing something like this? I guess it could be a combination of styles and eventing. I'd rather not invent any wheels that might be out there (I got the idea specifically from looking at Tortoise' "Show Log" window, but I've seen it before).
Does anyone have any sample code they can share to do this? Or a an alternative idea that also saves space and simplifies the layout?
Cheers,
Berryl
Kevin Moore's InfoTextBox, which is part of his Bag-O-Tricks is the kind of thing I was looking for, almost exactly. This is also the 'watermark' (great name - I would have found this sooner if I had known that) text box from another post.