I am developing a WPF app from 2 locations, one has a beefy PC on windows 10, the other has a much older PC with worse hardware, running Windows 7.
on the windows 10 PC, I never notice a problem, this is only reproducible on windows 7 machine.
In my Window, I have a ContentControl which is bound to a UserControl property in the window's viewmodel.
I can show different usercontrols there, and most behave fine. I have 2 however, which when I attempt to load them, they take literally 3-5 seconds, during which the UI thread hangs.
They don't have much going on in xaml, I have more complex stuff in xaml in other controls so I don't think the problem lies there.
The one thing these 2 controls are doing differently, which other controls which don't have this issue aren't doing is in the constructor for the usercontrol in the .xaml.cs file, they set their datacontext.
InitializeComponent();
DataContext = new CreateGroupPanelViewModel();
The contructor for the viewmodel, just sets some properties to values. Mainly some string to string.Empty, instantiates 2 ObservableCollections, sets a bool to true and sets a string to "Create Game".
The first time I open this control, I have the problem but the second time it poses no delay at all. Also, if I run the program for a minute or so and THEN try to open it for the first time it will also be fine.
I cannot understand why instantiating this usercontrol would create such a massive performance hit, or why it would act so differently on the 2 different machines.
EDIT
The slowdown occurs within the InitializeComponent(); of the usercontrol.
Here is the XAML of such a control:
<UserControl x:Class="CasinoDB.UserControls.ModifyPanels.UCModifyGamePanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:CasinoDB.UserControls.ModifyPanels"
xmlns:vm="clr-namespace:CasinoDB.ViewModels"
mc:Ignorable="d"
d:DesignHeight="500" d:DesignWidth="300">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="{Binding Header}" HorizontalAlignment="Center" Margin="5" FontWeight="Bold" FontSize="20" />
<StackPanel Grid.Row="1" HorizontalAlignment="Center">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="5">
<TextBlock Text="Name:" Margin="5" />
<TextBox Text="{Binding Name, UpdateSourceTrigger=PropertyChanged}" Margin="5" MinWidth="150" />
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="5">
<TextBlock Text="RTP:" Margin="5" />
<TextBox Text="{Binding RTP, UpdateSourceTrigger=PropertyChanged}" Margin="5" MinWidth="50" />
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="5">
<TextBlock Text="Variance:" Margin="5" />
<TextBox Text="{Binding Variance, UpdateSourceTrigger=PropertyChanged}" Margin="5" MinWidth="150" />
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="5">
<TextBlock Text="Lines:" Margin="5" />
<TextBox Text="{Binding Lines, UpdateSourceTrigger=PropertyChanged}" Margin="5" MinWidth="100" />
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="5">
<TextBlock Text="Min Bet:" Margin="5" />
<TextBox Text="{Binding MinBet, UpdateSourceTrigger=PropertyChanged}" Margin="5" MinWidth="50" />
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="5">
<TextBlock Text="Max Win:" Margin="5" />
<TextBox Text="{Binding MaxWin, UpdateSourceTrigger=PropertyChanged}" Margin="5" MinWidth="75" />
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="5">
<TextBlock Text="Vendor:" Margin="5" />
<TextBox Text="{Binding Vendor, UpdateSourceTrigger=PropertyChanged}" Margin="5" MinWidth="150" />
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="5">
<TextBlock Text="Notes:" Margin="5" />
<TextBox Text="{Binding Notes}" Margin="5" Width="250" TextWrapping="Wrap" AcceptsReturn="True" AcceptsTab="True" SpellCheck.IsEnabled="True" Height="75" VerticalScrollBarVisibility="Auto" ScrollViewer.CanContentScroll="True" />
</StackPanel>
<CheckBox Content="Create Another" IsChecked="{Binding CreateAnother}" Margin="5" Visibility="{Binding ShowCreateAnother, Converter={StaticResource BooleanToVisibilityConverter}}" HorizontalAlignment="Center" HorizontalContentAlignment="Center" />
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="5">
<Button Content="SAVE" Command="{Binding Save}" Margin="5" Style="{StaticResource ConfirmButton}" />
<Button Content="CLOSE" Command="{Binding Close}" Margin="5" />
</StackPanel>
</StackPanel>
</Grid>
</UserControl>
OK, so after attempting to isolate the issue, I finally found my problem. It lies in SpellCheck.IsEnabled="True" on TextBoxes. I found this by commenting out large sections, testing performance, then uncommenting small amounts until it was acting slow on the machine it acts slow on.
After figuring this was the cause, I found a similar post on SO with information relating to a registry entry being filled up with dictionairies. I don't appear to have an entry in that location in the registry, so maybe my problem was similar, but that it was looking and couldn't find anything at all.
Anyway, I can live without spellcheck in those fields, I'll just remove it.
Related
I'm working on a project in which I'm setting content using JSON Binding in Grid view but now I want to get Text of item when it is selected. XAML CODE:
<GridView ItemsSource="{Binding}" HorizontalAlignment="Center" Margin="0,10,0,0" x:Name="dataList" VerticalAlignment="Center" SelectionMode="None" SelectionChanged="dataList_Selection">
<GridView.ItemTemplate>
<DataTemplate>
<StackPanel Width="450" Height="300">
<Image Source="{Binding Top}" Margin="0,0,0,0" Stretch="None" />
<TextBlock x:Name="title" Text="{Binding Title}" Foreground="Black" HorizontalAlignment="Center" FontFamily="Assets/Font/MixBrush.ttf#MixBrush" FontWeight="Bold" FontSize="50" Margin="0,10,0,0" />
<Image Source="{Binding Bottom}" Margin="0,0,0,0" Stretch="None" />
<TextBlock Text="{Binding first}" Foreground="Black" HorizontalAlignment="Center" FontFamily="Assets/Font/Comfortaa_Regular.ttf#Comfortaa" FontSize="20" Margin="0,50,0,0" />
<TextBlock Text="{Binding second}" Foreground="Black" HorizontalAlignment="Center" FontFamily="Assets/Font/Comfortaa_Regular.ttf#Comfortaa" FontSize="20" Margin="0,0,0,0" />
<TextBlock Text="{Binding third}" Foreground="Black" HorizontalAlignment="Center" FontFamily="Assets/Font/Comfortaa_Regular.ttf#Comfortaa" FontSize="20" Margin="0,0,0,0" />
</StackPanel>
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
Here I want to get Text of "title" programmatically. Please share your knowledge with me. :-)
********************** Thank You ************************
On your back code use:
title.Text;
After long hard struggle I found my answer.
var selection = (myClass) dataList.SelectedItem;
await new MessageDialog(selection.Title).ShowAsync();
And I got perfect result.
Thank You.
I have upgraded a project from VS 2012 to VS 2015 and I am getting bizarre errors. On some windows it complains about Color and Brush definitions even though I am doing absolutely nothing with any colors or brushes. The project will compile but the editor gives errors. As an example, on the XAML code:
<ComboBox x:Name="cbCountry" Grid.Column="1" VerticalAlignment="Bottom" Height="28" FontSize="12" SelectionChanged="cbCountry_SelectionChanged"
HorizontalContentAlignment="Stretch" IsEditable="True" StaysOpenOnEdit="True" IsManipulationEnabled="True" KeyUp="cbCountry_KeyUp" />
complains about the color. Huh? What color? This is a pretty vanilla page with nothing fancy going on, anybody have any ideas how to eliminate these errors?
Update
I had some windows resources defined as:
<Window.Resources>
<DataTemplate x:Key="CityTemplate">
<StackPanel Orientation="Horizontal">
<Border BorderThickness="1" BorderBrush="Black">
<TextBlock Text="{Binding City}" />
</Border>
</StackPanel>
</DataTemplate>
</Window.Resources>
which does have a BorderBrush defined, but not for the combo. I tried taking a piece out at a time starting with the BorderBrush. It wasn't until I completely removed the <Windows.Resources> section that the error went away. Does anyone see anything wrong in the Windows Resources to cause this?
Update 2
The problem seems to be independent of any code behind. The entire XAML is below:
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ig="http://schemas.infragistics.com/xaml"
x:Class="PTHWPF.View.Lookup"
Title="Lookup Place of Birth" Height="400" Width="600" Loaded="Window_Loaded"
Icon="/PTHWPF;component/Resources/Images/LookupMap.png">
<!--TextBlock.TextAlignment="Center" -->
<Window.Resources>
<DataTemplate x:Key="CityTemplate">
<StackPanel Orientation="Horizontal">
<Border BorderThickness="1" BorderBrush="Black">
<TextBlock Text="{Binding City}" />
</Border>
</StackPanel>
</DataTemplate>
</Window.Resources>
<Grid IsManipulationEnabled="True" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="110" />
<ColumnDefinition Width="280*" />
<ColumnDefinition Width="180*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="60" />
<RowDefinition Height="50" />
<RowDefinition Height="50" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Label Content="Country or State" Height="28" HorizontalAlignment="Right" x:Name="lbCountry" VerticalAlignment="Bottom" />
<ComboBox x:Name="cbCountry" Grid.Column="1" VerticalAlignment="Bottom" Height="28" FontSize="12" SelectionChanged="cbCountry_SelectionChanged"
HorizontalContentAlignment="Stretch" IsEditable="True" StaysOpenOnEdit="True" IsManipulationEnabled="True" KeyUp="cbCountry_KeyUp" >
</ComboBox>
<Label Content="City" Grid.Row="1" Height="28" HorizontalAlignment="Right" x:Name="lbCity" VerticalAlignment="Bottom" />
<ig:XamMultiColumnComboEditor SelectionChanged="cbCity_SelectionChanged"
Grid.Column="1" Grid.Row="1"
HorizontalAlignment="Stretch"
x:Name="cbCity" Height="28"
VerticalAlignment="Bottom"
DataContext="{Binding}"
DisplayMemberPath="City"
HorizontalContentAlignment="Left"
IsTabStop="True" MinWidth="250"
FilterMode="FilterOnPrimaryColumnOnly"/>
<DockPanel Grid.Column="1" Grid.Row="2" HorizontalAlignment="Center" >
<Button Background="#9F7F90FC" Height="30" x:Name="btnOk" Width="80" Style="{DynamicResource RoundedButton}" HorizontalAlignment="Left" IsDefault="True" Click="btnOk_Click" VerticalAlignment="Bottom" Margin="0,0,20,0">
<StackPanel Orientation="Horizontal">
<Image Height="20" Source="/PTHWPF;component/Resources/ok.png" Width="20" />
<AccessText Margin="5,3,0,0" x:Name="btnOkText" Text="_Ok"/>
</StackPanel>
</Button>
<Button Background="#9F7F90FC" BorderBrush="#95FFFFFF" Height="30" x:Name="btnCancel" Style="{DynamicResource RoundedButton}" Width="80" IsCancel="True" Click="btnCancel_Click" VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="20,0,0,0">
<StackPanel Background="{x:Null}" Orientation="Horizontal">
<Image Height="20" Source="/PTHWPF;component/Resources/Images/cancel.png" Width="20" />
<AccessText Margin="5,3,0,0" x:Name="btnCancelText" Text="_Cancel"/>
</StackPanel>
</Button>
</DockPanel>
</Grid>
</Window>
Apparently Visual Studio 2015 Enterprise Edition had some issues, this also included "Handler=..." errors such as found here:
https://connect.microsoft.com/VisualStudio/feedback/details/1611888/xaml-editor-error-invalid-value-for-property-handler-and-ischecked-bug-remains-in-the-enterprise-version-of-vs-2015
I encountered it as well on other XAML files, but it didn't cause the designer to fail.
Solution:
Upgrade to Service Pack 1 found here:
https://www.visualstudio.com/en-us/news/vs2015-update1-vs.aspx
It is a web update and it took over an hour to do. I will also require a reboot of windows to finish, so keep that in mind. Hopefully anyone finding this post won't spend days like I did to fix the problem.
Is there is any way to get grid view item after double click. I have not found double click event in metro gird view. Only events like ItemClick and PointerPressed are there. Any suggestion?
<GridView Name="downloadGrid"
HorizontalAlignment="Left"
ItemsSource="{Binding Source={StaticResource CollectionItems}}"
Grid.Column="0" Grid.Row="2" PointerPressed="downloadGrid_PointerPressed"
ItemContainerStyle="{StaticResource CustomGridViewItemStyle}"
Width="Auto" SelectionChanged="downloadGrid_SelectionChanged">
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<WrapGrid Orientation="Horizontal" />
</ItemsPanelTemplate>
</GridView.ItemsPanel>
<GridView.ItemTemplate>
<DataTemplate>
<Grid Margin="6" Height="280" Width="200">
<Grid.RowDefinitions>
<RowDefinition Height="120"/>
<RowDefinition Height="35"/>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<Image Source="{Binding Path=Thumbnail}" HorizontalAlignment="Left" Grid.Row="0" Stretch="Fill"/>
<Image Grid.Row="0" Source="{Binding Path=Type, Converter={StaticResource Icon}}" MaxWidth="20" MinWidth="20" VerticalAlignment="Bottom" HorizontalAlignment="Left"/>
<TextBlock Text="{Binding Path=Caption}" TextWrapping="Wrap" Foreground="#FF017DD5" Grid.Row="1" HorizontalAlignment="Left" FontSize="11" Margin="3,0,0,0" Height="Auto"/>
<ProgressBar Grid.Row="2" Value="{Binding Path=PercentOfCompletion, Converter={StaticResource ProgressConverter}}" Width="75" Height="11" HorizontalAlignment="Left" VerticalAlignment="Center" FontFamily="Segoe UI" BorderThickness="1" Foreground="#FF78D200" Margin="3,0,0,0">
<ProgressBar.BorderBrush>
<SolidColorBrush Color="#FF78D200"/>
</ProgressBar.BorderBrush>
</ProgressBar>
<!--<TextBlock Grid.Row="2" Text="{Binding Path=PercentOfCompletion, Converter={StaticResource ProgressConverter}}" Margin="-15,0,15,0" VerticalAlignment="Center" HorizontalAlignment="Center" FontFamily="Segoe UI" Foreground="#333333" FontSize="12"/>-->
<TextBlock Grid.Row="2" HorizontalAlignment="Right" VerticalAlignment="Center" Text="{Binding Path=StatusInfo}" Style="{StaticResource MainPageTextStyle}" Margin="0,0,5,0"/>
<Button x:Name="playNow" Grid.Row="3" Content="Play Now" HorizontalAlignment="Left" VerticalAlignment="Center" Style="{StaticResource DownloadButtonStyle}" Click="playNow_Click" Margin="3,0,0,0" IsEnabled="{Binding IsPlay}"/>
<Button x:Name="pauseResumeBUtton" Grid.Row="3" Content="Pause" HorizontalAlignment="Right" VerticalAlignment="Center" Style="{StaticResource DownloadButtonStyle}" Click="pauseResumeBUtton_Click" Margin="0,4,3,2" IsEnabled="{Binding IsResume}"/>
<TextBlock Grid.Row="4" HorizontalAlignment="Left" VerticalAlignment="Center" Text="Size: " Style="{StaticResource MainPageTextStyle}" Margin="5,0,0,0"/>
<TextBlock Grid.Row="4" HorizontalAlignment="Right" VerticalAlignment="Center" Text="{Binding Path=OriginalFileSize, Converter={StaticResource FileSizeConverter}}" Style="{StaticResource MainPageTextStyle}" Margin="0,9,5,6"/>
<!--<TextBlock Grid.Row="5" HorizontalAlignment="Left" VerticalAlignment="Top" Text="Output: " Style="{StaticResource MainPageTextStyle}" Margin="5,0,0,0"/>
<TextBlock Grid.Row="5" HorizontalAlignment="Right" VerticalAlignment="Top" Text="iPhone / iPod" Foreground="#FF017DD5" FontSize="12" Margin="0,2,5,0"/>-->
</Grid>
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
The problem with using a Tapped (or DoubleTapped) event is that these events only fire when it detects a Tap gesture. "Well, yeah. That's exactly what I want", you may say.
Buuuuuut if you are using a mouse and you click on your item and the mouse moves a little bit (or a lot) before you release your finger, then that event is not recognized as a Tap. So that event will not fire. This can lead to the user not understanding why his clicks are not being recognized. This can be reproduced easily and consistently.
Potential Hacky Solution
The only way I can currently think of implementing what you would to do is by using the ItemClick event. When a GridViewItem is clicked, start a timer. The next time the ItemClick event fires, check if the same item was clicked within a reasonable amount of time (500ms? Less? I'm sure this is a quick Google away).
Of course you have to make sure you take care of stopping the timer and all that stuff.
As VasileMarianFălămaș wrote in the comments to your question you can use the double tapped event.
however you should question yourself if you want double tap events on a grid item. One of the best Windows 8 features is that app apps function the same way. Users shouldn't have to think if they should double tap or just tap in this application.
What action do you want to do when double tapping? opening the item? this is normally done by single tap.
here is an overview of when which gestures are used in Windows 8 apps:
http://msdn.microsoft.com/en-us/library/windows/apps/hh761498.aspx
I have the following XAML in my Windows Phone app:
<StackPanel Orientation="Horizontal">
<Grid x:Name="LayoutRoot">
<Image Source="{Binding ImageUrl}" Height="80" HorizontalAlignment="Left" Margin="10,10,0,0" Stretch="Fill" VerticalAlignment="Top" Width="93" />
<TextBlock name="NameBlock" Text="{Binding Name}" FontSize="30" Margin="150,20,0,0" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top" Width="300" />
<TextBlock name="DescriptionBlock" Text="{Binding Description}" FontSize="25" Margin="150,150,0,0" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top" Width="300" />
</Grid>
</StackPanel>
Currently, I have the margin of the second TextBlock (DescriptionBlock) set to a static value. Now because I have the work wrapping of the first TextBlock (NameBlock) set to "Wrap", the height of the TextBlock is variable.
Does anyone know how to make the top-margin of DescriptionBlock equal to the automatic height of NameBlock? This would ensure that the second DescriptionBlock appears directly below the NameBlock, regardless of the length of the text of NameBlock.
Many thanks!
Brett
This is what panels are for. Wrap the two text blocks in stack panel and it will stack the text blocks one above the other.
<Grid x:Name="LayoutRoot">
<Image Source="{Binding ImageUrl}" Height="80" HorizontalAlignment="Left" Margin="10,10,0,0" Stretch="Fill" VerticalAlignment="Top" Width="93" />
<StackPanel Margin="150,20,0,0" Width="300">
<TextBlock name="NameBlock" Text="{Binding Name}" FontSize="30" TextWrapping="Wrap" HorizontalAlignment="Left" />
<TextBlock name="DescriptionBlock" Text="{Binding Description}" FontSize="25" TextWrapping="Wrap" HorizontalAlignment="Left" />
</StackPanel>
</Grid>
A panel that holds a single child is usually useless, so I removed the stack panel around the grid.
If you'd like to continue using Grid you can define rows for it to size automatically.
I'm trying to split a button in half so that I can show text data in each half - which can also be increased in size when the application is expanded.
This is the code I've got soo far.
<Button Margin="16,0,16,6" Background="#daf0fc" BorderThickness="0" Height="Auto" HorizontalAlignment="Stretch" BorderBrush="White" Click="edit_house" Padding="0" Focusable="False">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Vertical" VerticalAlignment="Top" HorizontalAlignment="Left" Background="Black">
<StackPanel Orientation="Horizontal">
<TextBlock Margin="0,0,5,0" Text="{Binding house_number}" FontWeight="Bold" FontSize="14" />
<TextBlock Margin="0,0,0,0" Text="{Binding street}" FontWeight="Bold" FontSize="14" />
</StackPanel>
<TextBlock Text="{Binding postcode}" />
<TextBlock Margin="0,6,0,0" Text="{Binding house_type_text}" />
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Vertical" VerticalAlignment="Top">
<StackPanel Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="0,2,0,0">
<TextBlock Text="£" HorizontalAlignment="Right" Foreground="#FF9D1818" FontWeight="ExtraBold" FontSize="16" />
<TextBlock Text="{Binding house_price}" HorizontalAlignment="Right" Foreground="#FF9D1818" FontWeight="ExtraBold" FontSize="16" />
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="0,0,0,0">
<TextBlock Margin="0,0,0,0" Text="{Binding sold_text}" HorizontalAlignment="Right" Foreground="#FF107910" FontWeight="ExtraBold" FontSize="14" />
</StackPanel>
</StackPanel>
I've tried setting each StackPanel half to stretch, but they both just Float in the centre of the button, so I can't align the text on either half.
Here's a graphical representation of the button I'm trying to create...
Update:
Here is what I'm getting with the code above, sadly I'm struggling to get the text to align, or to get anything to stretch to the full width of each half:
StackPanel won't do that; it just stacks elements.
Instead, use a <Grid> with two columns.
StackPanel is not the right container for this. Try using a Grid like this:
<Button>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0">
...
</StackPanel>
<StackPanel Grid.Colunn="1">
...
</StackPanel>
</Grid>
</Button>
I like to use UniformGrids, although a Grid will also work if you need to define your Rows/Columns individually
Here's an example, with correct alignments:
<UniformGrid Columns="2">
<StackPanel Background="LightBlue" >
<StackPanel Orientation="Horizontal">
<TextBlock Margin="0,0,5,0" Text="123" FontWeight="Bold" FontSize="14" />
<TextBlock Margin="0,0,0,0" Text="Main Street" FontWeight="Bold" FontSize="14" />
</StackPanel>
<TextBlock Text="12345" />
<TextBlock Margin="0,6,0,0" Text="Type" />
</StackPanel>
<StackPanel Background="Yellow">
<StackPanel Orientation="Horizontal" VerticalAlignment="Top" Margin="0,2,0,0" HorizontalAlignment="Right">
<TextBlock Text="£" HorizontalAlignment="Right" Foreground="#FF9D1818" FontWeight="ExtraBold" FontSize="16" />
<TextBlock Text="100.00" HorizontalAlignment="Right" Foreground="#FF9D1818" FontWeight="ExtraBold" FontSize="16" />
</StackPanel>
<TextBlock Margin="0,0,0,0" Text="200.00" HorizontalAlignment="Right" Foreground="#FF107910" FontWeight="ExtraBold" FontSize="14" />
</StackPanel>
</UniformGrid>
You might also be interested in checking out this link, which gives you a quick visual look at each of WPF's different layouts and how they act.