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.
Related
I have a button, and when the mouse goes over it, I'd like to swap the foreground and background colors. (The original foreground and background are inherited from the parent control.) I have written the code below:
<Style TargetType="Button">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{Binding RelativeSource={RelativeSource Self}, Path=Foreground, Mode=OneTime}"/>
<Setter Property="Foreground" Value="Black"/>
</Trigger>
</Style.Triggers>
</Style>
But when the mouse moves over the button, the entire element goes black! Is there a way to force the one time binding on Background to finish before Foreground is set to black (sequentially)?
Is it possible to use a style trigger from another control?
I have Border control which lives in the indicator part of each row of a grid (the indicator is the part on the very left with the little arrow). I want to set the background depending if the row is selected. So I created a style:
<controls:SelectionConverter x:Key="SelectionConverter" />
<Style x:Key="SelectionStyle" TargetType="Border">
<Setter Property="Background" Value="{Binding Converter={StaticResource SelectionConverter}}"/>
<Style.Triggers>
<!-- here I want to have a trigger which reacts on a property of the grid control -->
</Style.Triggers>
</Style>
The border control then will use the style (in fact there are 3 border controls).
The SelectionConverter will return the correct color depending on the row (that works fine).
The problem is that the background is not updated when I select a different cell (which does make sense, because there is no trigger when to update it).
Is it possible to setup a trigger of the parent control?
Something alone the line
<Trigger Property="ParentControl.SelectionHasChanged" Value="True"></Trigger>
You should be able to use ElementName in your Binding to achieve this. For example, the following binds to the IsEnabled property of a Grid and sets the Background property of the Border to red when this is true:
<Grid x:Name"main_grid">
...
<controls:SelectionConverter x:Key="SelectionConverter" />
<Style x:Key="SelectionStyle" TargetType="Border">
<Setter Property="Background" Value="{Binding Converter={StaticResource SelectionConverter}}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsEnabled, ElementName=main_grid}" Value="True">
<Setter Property="Background" Value="Red" />
</DataTrigger>
</Style.Triggers>
</Style>
...
</Grid>
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.)
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>
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.