Customize Background color for ScrollBar in Windows Store Apps - xaml

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}"/>

Related

How to apply stroke to textblock in xaml under uwp 10 app

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.

UWP mediaplayerelement how to display extra text on top part of transport media control?

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>

RichEditBox text wrapping UWP

I am trying to get a RichEditBox to take over the entire width of the app window and to be responsive to window resizing, so far the code I have is the following:
<RichEditBox HorizontalAlignment="Stretch"
TextWrapping="WrapWholeWords"
Height="250"
Name="Intro"/>
What I am getting from the code above is this:
Any ideas on how can I get this to work? Why is it that I tell the text to wrap and it doesn't follow?
UPDATE
I also tried this:
<RichEditBox HorizontalAlignment="Stretch"
Height="250"
Name="Intro"/>
But the result is:
The problem that I am having is that it seems that HorizontalAlignment="Stretch" does not really do anything. The only way I am able to set a decent width is by hard-coding it, for example: Width="600". But if I do this my UI will not respond correctly to resizing. I also tried HorizontalContentAlingment="Stretch" but the result is exactly the same.
How can I get my RichEditBox take up all the available Width and Wrap at the same time?
If you look at the documentation of RichEditBox.TextWrapping, you'll notice that WrapWholeWords is invalid. You have to use
<RichEditBox TextWrapping="Wrap"/>
-or-
<RichEditBox TextWrapping="NoWrap"/>
Since Wrap is the default value, you can drop the property.
<RichEditBox HorizontalAlignment="Stretch"
Height="250"
Name="Intro"/>
Edit: in reply to the updated question:
A control only takes the width of it's parent control. Some container controls (e.g. Grid) automatically take the full width available, while others (e.g. StackPanel) only take the required size of it's children. Using HorizontalAlignment="Stretch" in combination with a StackPanel as a parent control, will only use the MinWidth property instead of the full available width on your screen. Sometimes you can't directly see this issue, e.g. when your control is inside an itemtemplate of a ListView. Use the Live Visual Tree in Visual Studio to find the parent containers and locate the issue.
So in short: make sure your RichEditBox is inside a Grid (or similar control) instead of a StackPanel.

Windows Phone ListBox Circle Image View

My Requirement is i need to display my ListBox with Some Images in Circle View like Below image
i search more but i didn't find any thing
In XAML you want to make the circle using an Ellipse control. Then give it an ImageBrush fill.
<Ellipse>
<Ellipse.Fill>
<ImageBrush ImageSource="YourImage.png"/>
</Ellipse.Fill>
</Ellipse>

Adding transparent filter to Panorama background like Market place

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