I am making a windows 8 phone app and I want to add arabic text items to a longlistselector. Its orientation is supposed to be right from left but I cannot get it to align in the proper direction. Is there a way in Windows 8 xaml to detect the reading order of the text and adjust alignment accordingly?
At the Window/Page level, add the following property
FlowDirection="RightToLeft"
This is a Bindable property, so it can be set at Application Level, and the changes reflected with minimal amount of code.
Related
I have a requirement to create a button in a Windows 8.1 app which has an icon and a text label. The icon will be a symbol from Segoe UI Symbols and the text label will be Segoe UI Semibold at a smaller text size.
I want to be able to reuse the button in different places within the app, using different icons and text labels.
How show I go about this? I could create a button and then edit the ContentPresenter to have a horizontally oriented stack panel with two TextBlocks, but then how could I reuse this? And how could I change the text in the two different text blocks?
Should I create a separate custom control with separate dependency properties for each of the textblock strings? I'm interested in hearing what you would do.
thanks
Create a simple Style. To make it easy, I would base it off the standardized AppBarButton style. You can format it to whatever size you want (I have done something similar to make a larger button or one with text on the side).
Have the main icon simply be a ContentPresenter which binds to the Content using a TemplateBinding. Make sure to set the FontFamily to Segoe UI Symbol. Have the text label pull from AutomationProperties.Name, similar to how the AppBarButton style does.
Then, whenever you want to use this just do:
<Button Style="{StaticResource MyCustomButtonStyle}"
Content="" // Where "000" is replaced by the number of the icon you wish to use.
AutomationProperties.Name="Text Label"/>
This should be extensible and easily reproducible to whatever location you need. When copying over the AppBarButton style, I suggest removing the artificial size limits (specifically the width of the main content Grid). I do suggest either giving the Text Label a fixed size or having it pull its size from the specified parent Width, so that it will Wrap correctly.
Hope this helps and happy coding!
Are you desiring to create something like for an AppBar? Take a look at AppBarButton and the style/types it supports. In Windows 8.1 we added some things around SymbolIcon specifically. Since you basically want two pieces of 'content' for your style you'll have to re-purpose one property (unless you create a custom control which doesn't sound needed for this scenario). Using AutiomationProperties.Name for the visible label is a good idea because it will also help with accessibility by default for those users.
Investigate the style for AppBarButton to get you started.
i'm trying to do an application for Windows 8 and i'm following a guide on channel9.msdn
I cant understand why they use XAML to create textbox, label or other controls.
There's a reason ? There's a form which is much faster: simply drag & drop controls into the UI.
So why use XAML ?
Thanks all and sorry for my english :/
XAML supports laying out the form so that if you resize the window, the controls contained in the window are always consistently positioned according to the layout.
If you just drag and drop, you will see that the designers uses margins to position the controls. When you resize the window, they kind of keep the same position and are not going to be well positioned anymore.
This layouting is the essence of WPF. Just read a tutorial about layouting in WPF.
Drag and drop creation of UIs when using XAML creates very poorly formatted XAML and since there are a significant number of things which are most easily done in XAML (data templates for instance), it's easier to simply construct your UI in XAML from the start.
I'm trying to make my WP7 app work well on WP8 (by compiling it as a WP8 app).
In my app, I'm changing the PhoneAccentBrush's Color which seems to work fine still, however TextBox's in WP8 now seem to show a border around it when the textbox is in focus (this wasn't happening for me on WP7). This border seems to always use the System's accent color instead of using the changed color like every other control.
Any idea what's going on here and how to change it? The red accent (if that's what the user has chosen) really clashes with my app's colors!
I would call overriding the accent color a hack. I would avoid setting the accent color and create a template for your textBlock.
Blend makes this very easy by allowing you to copy the default template and make changes to it.
Right Click the textBox in the Objects and Timeline pane, then select Edit Template -> Edit Current. Then select the States tab and select the Focused FocusState, then edit the border brush. Save and reuse the template as needed.
I did notice the textBox control template has changed in 8 and now defines the focus state border brush, although it does default to the PhoneAccentBrush.
I'm trying to create a live tile for my application, using a user control.
The user control contains a grid, an image and a rectangle filled with color.
Now here comes the funny part.
I want the rectangle to act as a background for the tile's title, and the image to fill the rest of the tile. And i said to myself, well, lets put some rows in that grid and set the like you usually set them in a WPF/SL application.
I then write the entire thing in a WBM and save it to isostore.
The problem is, the parser seems to ignore the presence of grid's rows. regardless of what I try, the rectangle is not shown, and the image covers the full tile, when it should only cover the first row. It is as if the grid didn't even existed.
Another funny aspect is that it doesn't matter if I use rows or columns, the result is the same.
Any ideas?
Are you using the following method?
Dynamic LiveTile - adding background image?
I recently implemented a Live Tile using a Grid with Rows and Columns for layout of some TextBlocks. I encountered similar challenges, so I placed the control that I was using for my Live Tile on a blank page in my app to better see what was happening. Does the control render correctly when displayed on a page (versus being rendered to a WriteableBitmap)?
Another idea. Instead of trying to position the Rectangle relative to the tile's Title, why not leave the Title property blank and put the same text in a TextBlock within the user control?
If you are careful about the font and positioning of the TextBlock, the text on the resulting background image can appear indistinguishable from text displayed from the Title property. I decided to follow this strategy myself. I found the font information in the following answer:
Font size and family for a tile's title
Otherwise, could you post an example of the XAML you are using?
I would like to create a PanoramaItem that has no header at all. I would like to place some controls in this PanoramaItem and I want them to occupy the whole space. Of course I was able to delete the header text and change the font to smaller, but still there are some margins left. This might be easy, but I am new to WP7 development...
Is it possible to achieve and how?
Thanks in advance!
Negative top margin may be the quickest way to get rid the stubborn header padding.
<controls:Panorama Margin="0,-25,0,0">
</controls:Panorama>
You need to modify Styles of Panorama. There is was a question recently for Pivot here: Creating Pivot Footers on Windows phone 7 application, but you can do the same with a Panorama
<phone:Panorama.HeaderTemplate>
<DataTemplate>
<TextBlock FontSize="1"/>
</DataTemplate>
</phone:Panorama.HeaderTemplate>
it's a very funny method but for WP 8.1 Silverlight Apps this works fine.