Microsoft Xaml Element Equivalent of Xamarin Xaml "ContentView" - xaml

I have recently started a Xamarin Forms project specifically for the Universal Windows Platform. In attempt to add some global styles for the application, I have come across an element I don't know the uwp equivalent syntax for: Xamarin ContentView.
(ie. I know that Xamarin Label = UWPTextBlock, Xamarin HorizontalOptions = UWPHorizontalAlignment)
Xamarin:
<Style x:Key="errorContainer" TargetType="ContentView">
<Setter Property="BackgroundColor" Value="Red"/>
<Setter Property="HorizontalOptions" Value="Fill"/>
<Setter Property="Padding" Value="15"/>
</Style>
UWP:
<Style x:Key="errorContainer" TargetType="?????????">
<Setter Property="Background" Value="Red"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="Padding" Value="15"/>
</Style>
tldr; Xamarin ContentView = UWP ??????
Thanks for the help

ContentControl (and it's derived types like Border) should fit your need.
(Because it has a ContentTemplate Property, as Xamarin.Forms' ContentView derives from TemplatedView.)

Related

AutoSuggestBox FontFamily Consolas not taking

Not able to get AutoSuggestBox to accept Consolas or Courier New. Suggestions?
<AutoSuggestBox Text="Not Taking Consolas" Width="250" Height="40" FontFamily="Consolas" FontSize="18" />
AutoSuggestBox's template is composed of an inner TextBox and a ListView for the suggestions. The default AutoSuggestBox style sets its own values for the TextBox's FontFamily (and other properties), thus it does not inherit the value from the AutoSuggestBox. AutoSuggestBox does, however, expose a property TextBoxStyle which you can change to affect the appearance of the TextBox. You might also want to change the ItemContainerStyle too if you want the FontFamily to be applied to the ListView as well.
<AutoSuggestBox>
<AutoSuggestBox.TextBoxStyle>
<Style TargetType="TextBox">
<Setter Property="FontFamily" Value="Consolas"/>
<Setter Property="FontSize" Value="18"/>
</Style>
</AutoSuggestBox.TextBoxStyle>
<AutoSuggestBox.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="FontFamily" Value="Consolas"/>
<Setter Property="FontSize" Value="18"/>
</Style>
</AutoSuggestBox.ItemContainerStyle>
</AutoSuggestBox>

Change the default font size in themes in Windows Phone

I want to change the default value for Font Size in Windows Phone 8. that come from theme
I want to change the PhoneFontSizeExtraExtraLarge font size.
I tried
(Resources["PhoneFontSizeExtraExtraLarge"]) = 20;
but didn't work.
This can not be done directly.
We can create themes or styles that can be assign to buttons and textviews.
Example
<Style x:Key="Regular_24_BlackBrush" TargetType="TextBlock">
<Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilyNormal}"/>
<Setter Property="FontSize" Value="24"/>
<Setter Property="Foreground" Value="{StaticResource BlackBrush}"/>
</Style>

xaml listview how to disable space for scroll?

I working on a metro app and I am using listview
listview automatically puts some space on right side for scroll. In my code there is no need for scrolling
I tried to disable it ScrollViewer.VerticalScrollBarVisibility="Disabled" or scrollmode=false but the space allways appears
is there a way I could disappear it because listview highlights on over and click mode and it looks bad
Create a copy of the current ListView Style by selecting Edit Additional Templates -> Edit Generated Item Container -> Edit a Copy (see screenshot below).
In the template copy, modify the Margin (last line shown below)
<Style x:Key="ListViewItemStyle" TargetType="ListViewItem">
<Setter Property="FontFamily" Value="{StaticResource ContentControlThemeFontFamily}"/>
<Setter Property="FontSize" Value="{StaticResource ControlContentThemeFontSize}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="TabNavigation" Value="Local"/>
<Setter Property="IsHoldingEnabled" Value="True"/>
<Setter Property="Margin" Value="0,0,18,2"/>
to
<Setter Property="Margin" Value="0" />
You'll also need to set ScrollViewer.VerticalScrollBarVisibility="Hidden" on the ListView itself (like you tried before(, or you can get adventurous and modify the template for the ListView itself (Edit Template) and remove the ScrollViewer and set the ItemsPanelTemplate to just StackPanel from VirtualizingStackPanel.

Change the disabled color of a button in XAML Windows 8

I want to be able to change the background color of a button in XAML when it's disabled but I don't know what to override.
Anybody know what I need to do?
I'm create a Windows 8 store app using XAML and C# 4.5.
My current button style is as follows:
<Style x:Key="MySaveButtonStyle"
TargetType="ButtonBase">
<Setter Property="FontFamily"
Value="Segoe UI Symbol" />
<Setter Property="FontSize"
Value="36" />
<Setter Property="Content"
Value="" />
<Setter Property="Height"
Value="70" />
<Setter Property="Width"
Value="80" />
<Setter Property="BorderBrush"
Value="White" />
<Setter Property="Foreground"
Value="{StaticResource ButtonForegroudBrush}" />
<Setter Property="BorderThickness"
Value="1" />
<Setter Property="Background"
Value="White" />
</Style>
Thanks is advance.
You have to override the Default ControlTemplate of the Button.
To do this: Right Click the button in Designer View - Edit Template - Edit a Copy
then Visual Studio creates the default Template for you.
In the Template Code there is a VisualStateManager Section with groups and states.
And one of them is
<VisualState x:Name="Disabled">
//Change to your demands
</VisualState>
Here you can change it to anything what you want to do when a control is Disabled.

Inheritance in Silverlight 2 Styles

I want to build up styles in XAML, e.g.
<UserControl.Resources>
<Style x:Key="MyStyle" TargetType="TextBlock">
<Setter Property="Margin" Value="2,2,2,2" />
<Setter Property="Foreground" Value="DarkRed" />
</Style>
<Style x:Key="MyBoldStyle" TargetType="TextBlock">
<Setter Property="Style" Value="{StaticResource MyStyle}" />
<Setter Property="FontWeight" Value="Bold" />
</Style>
</UserControl.Resources>
But this does not work. (In Silverlight 2) How can I make one inherit from the other?
June 2010 Update: Style Inheritance is in Silverlight 3, use BasedOn="{StaticResource MyStyle}
Nevermind. I found the answer in MacDonald's Pro Silverlight 2 in C# 2008:
(source: apress.com)
"If you've used styles in WPF, you'll find
that Silverlight styles are
dramatically scaled back ... [for example, you can't]
create styles that inherit from other styles."
Too bad. Maybe in Silverlight 3.