I want to apply a black stroke on a white textblock in uwp app like the one shown in the picture below
It's actually called outlined text. The easiest way is find a specific outline font and apply it for the FontFamily property of the TextBlock control.
For example, you could download the font file '.ttf' and put it in the 'Assets' folder.
<TextBlock FontSize="42" Text="Hello World" FontFamily="Assets/your outlined font.ttf#font name"/>
Another way is using Win2D relevant APIs to render outlined text.
You could refer to the Win2D-ExampleGallery's TextOutlines sample for more details.
Related
Is there an easy way to get the content (text) on the left side of a ToggleSwitch control? (Else than messing up the Template).
Thanks
You should alter the template if you want to do it correctly.
However, if you want to fix it in a hacky way, change the FlowDirection of the control. But then you'll have to tweak with margins and alignments to make it look decent when used with other controls (see image below for default alignment).
<StackPanel>
<ToggleSwitch OffContent="Test" OnContent="Test2"></ToggleSwitch>
<ToggleSwitch OffContent="Test" OnContent="Test2" FlowDirection="RightToLeft"></ToggleSwitch>
</StackPanel>
A modified template displaying SwitchToggle content on the left can be found here.
I am writing a UWP 14393 app using mediaplayerelement in xaml file, I am wondering how can I display extra information in text on top of custom transport media control so that when player control is up, the text will show up at the same time?
For example, for a video player showing an online stream, and at the top left corner shows streamer name, view count, etc. The information only shows up when player control shows up.
Obviously, the best way to do this is to put the text inside custom transport media control, is it doable? If not, how can I achieve this?
I am a newbie at UWP, so any help will be welcome, thanks.
You can custom the MediaTransportControls's style, and add your own content to <Border x:Name="ControlPanel_ControlPanelVisibilityStates_Border">. See my test.
First download MediaTransportControls's style from my gist.
Or you can find it in your pc's generic.xaml file.
Then add this style to App.xaml.
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/MediaTransportControls.xaml"/>
</ResourceDictionary.MergedDictionaries>
Then you can use your style in MediaTransportControls.
<MediaPlayerElement
Width="300" Height="500"
AreTransportControlsEnabled="True"
Source="ms-appx:///Assets/elephantsdream-clip-h264_sd-aac_eng-aac_spa-aac_eng_commentary-srt_eng-srt_por-srt_swe.mkv">
<MediaPlayerElement.TransportControls>
<MediaTransportControls Style="{StaticResource myMediaTransportControlsStyle}">
</MediaTransportControls>
</MediaPlayerElement.TransportControls>
</MediaPlayerElement>
<MediaPlayerElement AreTransportControlsEnabled="True">
<MediaPlayerElement.TransportControls>
<MediaTransportControls>
<Grid>
<...Put any content here like textblocks and buttons all this content will be part of controls so they will appear and disappear along with the controls, this Grid covers all the area on the screen ( above the controls bar )...>
</Grid>
</MediaTransportControls>
</MediaPlayerElement.TransportControls>
</MediaPlayerElement>
I have been trying to customize the Background color of ScrollBar in Windows Stores Apps. But its not working. I have a doubt whether is it a limitation in WinRT?
Thanks in Advance.
My Code Snippet:
If you want to change the Background color of the ScrollBar, you need to change the default style of the Scrollbar and the Blend for Visual Studio can help you implement it very easily.
For how to changing the style of the Scrollbar, please first please right-click the Scrollbar control-->click "Edit Template"-->"Edit a Copy", after that you will see all the style which creates the Scrollbar, then please find the following xaml and change the "Fill" property of the "Rectangle" with the Background color which you want, in this way it will change the Background color of the ScrollBar:
<Rectangle Fill="Yellow" Margin="0" Grid.RowSpan="5" Stroke="{ThemeResource ScrollBarTrackBorderThemeBrush}" StrokeThickness="{ThemeResource ScrollBarTrackBorderThemeThickness}"/>
Tried adding a Coding4Fun RoundButton to my WP8 XAML. Looked around and copied from samples (i.e. this site), but despite the nice images I see everywhere, the text is displayed on top of my icon:
The XAML code is:
<c4f:RoundButton x:Name="buttonShrtn" Click="buttonShrtn_Click" ImageSource="Assets/Images/icon-button-32.png" FontSize="18" Content="Shrtn" VerticalAlignment="Center" HorizontalAlignment="Right"/>
I just can't find a similar case anywhere. Could there be something else in my XAML that can cause this?
You have to use Label instead of Content.
EDIT
RoundToggleButton, RoundButton, OpacityToggleButton, Tile, and ImageTile content property shifted to Label property. (geekchamp)
Toolkit description.
I am trying to add a transparent layer to my panorama background to dim the background image so the content can be displayed regardless of the colours in the images. Just like in the WP7 Market Place or the Pictures Hub on the phone.
I have played with the Opacity Mask. created a transparent image in paint.net to be used as opacity mask.
<ImageBrush x:Name="MyOpacityBrush" Stretch="Fill" ImageSource="../Images/imageFilter.png" />
<ImageBrush x:Name="panoramaBrush" ImageSource="../Images/cloudsPanorama.jpg" />
And use it in my Panorama like:
<controls:Panorama x:Name="ViewPanorama" Visibility="Visible" Background="{StaticResource panoramaBrush}" OpacityMask="{StaticResource MyOpacityBrush}" />
However, this dims the whole page including any content displayed as if the transparent image is on top of everything. Is there a trick I am missing here. Perhaps add the opacity to the Grid?
Set the opacity of the background image (in xaml) to 0.6. Black or White text will be readable.
You can just set the opacity of the PNG image that you use as the background image*?
No need for additional masks, etc.
*You can do this in Paint.net by opening the image and then editing the property of the layer to adjust the opacity.
Use an opacity mask in a brush built with your imageSource
Then use the brush as the background of your Panorama Control