Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to reduce margins on buttons inside WrapPanel in WP7?
    primarykey
    data
    text
    <p>I'm trying to make a 'palette' in WP7. Visually, I'm after a look similar to the keyboard (SIP) or the dialler. <strong>I'm trying to make the margins around the buttons smaller than what they are now.</strong></p> <p>I'm having a lot of trouble with doing this, however - I've tried setting different margin thicknesses both directly and by attaching a style, but can't seem to get the problem sorted.</p> <p>Here's an image of what I've got at the moment (sorry I'm a new user so it's just a link):</p> <p><a href="http://i40.tinypic.com/bj8g9f.jpg" rel="nofollow">http://i40.tinypic.com/bj8g9f.jpg</a></p> <p>And here's the relevant XAML I'm using.</p> <pre><code>&lt;phone:PhoneApplicationPage xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone" xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:tk="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit" mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768" x:Class="Mathflow.MainPage" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" SupportedOrientations="Portrait" Orientation="Portrait" shell:SystemTray.IsVisible="True"&gt; &lt;phone:PhoneApplicationPage.Resources&gt; &lt;Style x:Key="PaletteObjectStyle" TargetType="Button"&gt; &lt;Setter Property="Background"&gt; &lt;Setter.Value&gt; &lt;SolidColorBrush Color="#1F1F1F"/&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;Setter Property="Margin" Value="0" /&gt; &lt;Setter Property="BorderThickness" Value="0" /&gt; &lt;/Style&gt; &lt;Style x:Key="PaletteObjectText" TargetType="TextBlock"&gt; &lt;Setter Property="Margin" Value="8" /&gt; &lt;/Style&gt; &lt;/phone:PhoneApplicationPage.Resources&gt; &lt;StackPanel x:Name="LayoutRoot" DataContext=""&gt; &lt;Canvas x:Name="FlowContainer" Height="500"&gt; &lt;/Canvas&gt; &lt;ItemsControl x:Name="Palette" DataContext="{Binding Source={StaticResource FunctionsSource}}" ItemsSource="{Binding FunctionCollection}"&gt; &lt;ItemsControl.ItemsPanel&gt; &lt;ItemsPanelTemplate&gt; &lt;tk:WrapPanel Orientation="Vertical" Height="200" ScrollViewer.VerticalScrollBarVisibility="Disabled" /&gt; &lt;/ItemsPanelTemplate&gt; &lt;/ItemsControl.ItemsPanel&gt; &lt;ItemsControl.ItemTemplate&gt; &lt;DataTemplate&gt; &lt;Button Style="{Binding Source={StaticResource PaletteObjectStyle}}"&gt; &lt;TextBlock Text="{Binding Display}" Style="{Binding Source={StaticResource PaletteObjectText}}"/&gt; &lt;/Button&gt; &lt;/DataTemplate&gt; &lt;/ItemsControl.ItemTemplate&gt; &lt;/ItemsControl&gt; &lt;/StackPanel&gt; &lt;/phone:PhoneApplicationPage&gt; </code></pre> <p>Thanks very much! Any help would be greatly appreciated.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload