Is it possible to reduce the height of appbar in windows 8? - windows-8

I want to make a sleek looking thin appbar. Is it possible?

Setting Height and MinHeight work for me:
XAML:
<AppBar Height="25" MinHeight="25"> ... </AppBar>
HTML/CSS:
.win-appbar.sleek {
height: 25px;
min-height: 25px;
}
<div id="sleekAppBar" data-win-control="WinJS.UI.AppBar" class="sleek"
data-win-options=""> ... </div>

Let's think about this differently.
Why keep the AppBar the same size? The reason is, your application will visually align to the rest of the Windows 8 ecosystem. I am not saying yo can't change the AppBar; I'm just saying you had better have a good reason.
How to customize the AppBar? Here's my whole blog on the topic: http://blog.jerrynixon.com/2012/10/walkthrough-windows-8-appbar-you-might.html

Related

Unknown Spacing at Top of Popup

I am trying to create a popup using the Xamarin.CommunityToolkit package but the popup is rendering with extra spacing across the top. Because of hardware limitations I am forced to develop using a much older version of CommunityToolkit (1.2.0) and Xamarin.Forms (5.0) so the issue may be from this.
This is the sample popup I am trying to render.
<?xml version="1.0" encoding="utf-8" ?>
<xct:Popup xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:xct="clr-namespace:Xamarin.CommunityToolkit.UI.Views;assembly=Xamarin.CommunityToolkit"
Size="300,300"
Color="Blue"
x:Class="floorplanner.Dialogs.RoomDetailsDialog"
xct:Clip="">
<Label Text="Hello World" BackgroundColor="Green"/>
</xct:Popup>
This is what the popup looks like when it's opened:
So far I have tried configuring my MainTheme to have:
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
I have also tried specifying the size in a child layout element instead of the popup itself but it still rendered with the top spacing.
I have tried setting the VerticalOptions of the label to "Fill" and it still rendered as shown in the image. Originally, I had the label inside of a StackLayout but I removed this nesting to simplify the example for this post.
From more experiments I found that the Label itself is still rendering with a height of 300 units and the bottom the the Label's region is being clipped off the bottom. So essentially, there are ~50 units of height that are being pushed off the bottom.
As a workaround the the problem I have set the background of popup to transparent and set the inner content of the popup to the height - 50.
As you set the Color="Blue", the whole background of popup is blue.
You add a label to in the popup layout however you haven't set the location of the label. You can set VerticalOptions and HorizontalOptions to set the location.
Here is the xaml code:
<xct:Popup xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:xct="clr-namespace:Xamarin.CommunityToolkit.UI.Views;assembly=Xamarin.CommunityToolkit"
Size="300,300"
Color="Blue"
x:Class="floorplanner.Dialogs.RoomDetailsDialog"
xct:Clip="">
<Label Text="Hello World" BackgroundColor="Green" VerticalOptions="Start" HorizontalOptions="Start"/>
</xct:Popup>
Reference links:
https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/layouts/layout-options

Why background image width stretch longer than screen (browser)?

My website is responsive, but my background image keep stretch longer than screen (or browser) which make browser has scroll bar on the bottom because of an extra portion width to the right? My main contents are responsive. So this extra portion just background image.
If i added "background-repeat: no-repeat;" then there is still extra white color portion to the right which still make it extra that has scroll bar
If i removed the background image, there is also an extra white portion stretch to the right the same.
Here is my style.css
html {
-webkit-font-smoothing: antialiased;
text-rendering:optimizeLegibility;
}
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
color: black;
background: url(../images/wood_background.jpg);
}
you can adjust the width using
Example:background:size:100% 100%
You can adjust the percentage so that your image is adjusted accordingly

Full screen image in a metro windows 8 app

i am developing a Windows 8 "Metro" App. In this App I want to put an Image as a wallpaper.
The Image is 1600x900 Pixels big. Now, when i try a bigger Screen in the Simulator the Image
is not scaled to fill the whole Screen. How can i achieve this? I tried to follow the Microsoft
Guidelines for different Screen sizes, like for example putting the Image in a canvas, but it doesnt
work. Can someone help me?
Thank you very much
I am not sure what exactly what you have tried, or which guidelines your were looking at. But you can always add an ImageBrush to your Grid like this.
<Page
x:Class="App3.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App3"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid>
<Grid.Background>
<ImageBrush ImageSource="Assets/img101.jpg"/>
</Grid.Background>
<TextBlock Name="txt1" HorizontalAlignment="Center" VerticalAlignment="Center" Text="Hello World" FontFamily="Arial" FontSize="60" ></TextBlock>
</Grid>
</Page>
In one of my apps, I use a full-screen image as a background watermark, by using the following CSS:
.watermark {
position: absolute;
z-index: -1;
width: 100%;
height: 140%;
opacity: 0.05;
}
then, in the markup, I simply add an image tag, with the watermark class:
<img class="watermark" src="#" />
In my case, I'm setting the image source dynamically in the page's JS file, like so:
element.querySelector(".watermark").src = item.maptileUrl;
the above line grabs the URL for the image (a map tile) from the selected item that was passed to the page.
I tested my app in the simulator, and it works regardless of the screen size and resolution.
Be aware that depending on what your image is, using a width/height of 100% could result in your image being stretched vertically or horizontally.
Another possibly easier solution is to simply set the background-image style of the body tag to the desired image. You can read more about this property at http://www.w3schools.com/cssref/pr_background-image.asp (along with the background-repeat, background-size, etc.).

Easier way to center a label in Xul

Is there an easier way to center a label in Xul then with the following?
<xul:hbox>
<xul:spacer flex="1" />
<xul:label id="myLabel" value="LABEL"/>
<xul:spacer flex="1" />
</xul:hbox>
Yes. Use box packing via the pack attribute.
<hbox pack="center"><label id="myLabel" value="LABEL"/></hbox.
Two alternative ways which also work with multiline labels:
Use <label style="text-align: center"/>
Use <vbox align="center"><label/></vbox>

Formatted XUL Tab caption

Is there an easy way to have formatted tab captions in XUL? I want to have a specific part of the tab caption in bold font.
No easy way. XUL <tab>'s text is in a <label>, which doesn't give you fine-grained control over parts of the text. You'd have to replace it with a <description> which can contain HTML markup, but this is not a standard thing to do.
An easier way perhaps is to put multiple <label>'s inside the <tab>
Eg :
<tabbox>
<tabs>
<tab>
<label style="margin-right: 0px;" value="normal"/>
<label style="margin-left: 0px; font-weight: bold;" value="bold"/>
</tab>
</tabs>
</tabbox>
Of course it depends on what it's used for exactly.