I'm trying to align below controls horizontally by keeping the label and the combobox on the left and both buttons on the right. I've tried different approaches using StackPanel but nothing gives me the desired output. Appreciate if you guys could point out what am I doing wrong here?
Current Layout
XAML source
<StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Center" Orientation="Vertical" Margin="0,0,0,2" >
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal" VerticalAlignment="Center">
<Label Content="Age Bucket" HorizontalAlignment="Left" VerticalAlignment="Center" />
<ComboBox HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,0,0,0" Width="100"
SelectedValue="{Binding SelectedAgeBucket}"
DisplayMemberPath="DisplayMember" SelectedValuePath="ValueMember"
ItemsSource="{Binding AgeBuckets}" IsSynchronizedWithCurrentItem="True"/>
</StackPanel>
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Center" Orientation="Horizontal" Margin="0,0,0,2">
<Button Click="Button_Click_1" Content="Export" HorizontalAlignment="Right" />
<Button HorizontalAlignment="Right" VerticalAlignment="Center" Click="Button_Click_2" Content="Print" Margin="5,0" />
</StackPanel>
</StackPanel>
<telerik:RadDataPager x:Name="radDataPager" Source="{Binding Items, ElementName=grdDetails}" PageSize="100" />
</StackPanel>
Related
I'm using a grid view control in my uwp application and each grid view item contains a grid and a stackpanel. I want to make only grid to be clickable instead on the complete grid view item.
Here is my grid view code
<GridView
Grid.Row="1"
ItemsSource="{x:Bind ViewData}"
ScrollViewer.VerticalScrollBarVisibility="Hidden"
Margin="130,40,130,40">
<GridView.ItemTemplate>
<DataTemplate x:DataType="data:ViewArr">
<StackPanel Margin="50,25,50,25" >
<Grid Height="120" Width="120">
<Image
Source="assets/images/icons/check_my_blue.png"
Height="40"
Width="40"
Canvas.ZIndex="99"
Margin="80,0,0,80">
</Image>
<Canvas>
<Ellipse
Height="120"
Width="120"
Fill ="{x:Bind profile_color , FallbackValue='#00000'}"
StrokeThickness="3"
Stroke="Black" >
</Ellipse>
</Canvas>
<TextBlock
Text="{x:Bind profile_name}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
FontSize="28"
Foreground="White">
</TextBlock>
</Grid>
<StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,10,0,0">
<TextBlock Text="{x:Bind first_name}" FontSize="16" FontWeight="Bold" ></TextBlock>
<TextBlock Text="{x:Bind last_name}" FontSize="16" FontWeight="Bold"></TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,10,0,0">
<TextBlock Text="Today - " FontSize="14" FontWeight="Bold" Foreground="Gray" Margin="0,0,5,0"></TextBlock>
<TextBlock Text="0" FontSize="14" Foreground="Gray"></TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,10,0,0">
<TextBlock Text="Previous Tasks - " FontSize="14" FontWeight="Bold" Foreground="Gray" Margin="0,0,5,0"></TextBlock>
<TextBlock Text="0" FontSize="14" Foreground="Gray"></TextBlock>
</StackPanel>
</StackPanel>
</StackPanel>
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
And it creates something like this.
https://i.stack.imgur.com/0UmIx.png
I want to make only circles to be clickable not the text below that.
Is there any way to achieve that? Please guide me. Thanks in advance.
How to make only a part of gridview item clickable in uwp application?
For your requirement, you could set GridView IsItemClickEnabled property as false then listen Grid Tapped event like following.
<GridView IsItemClickEnabled="False" >
<GridView.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical">
<Grid Tapped="Grid_Tapped"
Width="30"
Height="30"
VerticalAlignment="Center"
Background="Red"
CornerRadius="15"
/>
<StackPanel VerticalAlignment="Center" Orientation="Vertical">
<TextBlock VerticalAlignment="Center" Text="NicoName" />
</StackPanel>
</StackPanel>
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
private void Grid_Tapped(object sender, TappedRoutedEventArgs e)
{
}
Try this.
<GridView
Grid.Row="1"
Margin="130,40,130,40"
IsItemClickEnabled="False"
ScrollViewer.VerticalScrollBarVisibility="Hidden">
<GridView.ItemTemplate>
<DataTemplate>
<StackPanel Margin="50,25,50,25">
<Button
BorderBrush="Transparent"
BorderThickness="0"
Command="{Binding MyCommandName}"
Foreground="Transparent">
<Grid Width="120" Height="120">
<Image
Width="40"
Height="40"
Margin="80,0,0,80"
Canvas.ZIndex="99"
Source="assets/images/icons/check_my_blue.png" />
<Canvas>
<Ellipse
Width="120"
Height="120"
Fill="{x:Bind profile_color, FallbackValue='#00000'}"
Stroke="Black"
StrokeThickness="3" />
</Canvas>
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="28"
Foreground="White"
Text="{x:Bind profile_name}" />
</Grid>
</Button>
<StackPanel>
<StackPanel
Margin="0,10,0,0"
HorizontalAlignment="Center"
Orientation="Horizontal">
<TextBlock
FontSize="16"
FontWeight="Bold"
Text="{x:Bind first_name}" />
<TextBlock
FontSize="16"
FontWeight="Bold"
Text="{x:Bind last_name}" />
</StackPanel>
<StackPanel
Margin="0,10,0,0"
HorizontalAlignment="Center"
Orientation="Horizontal">
<TextBlock
Margin="0,0,5,0"
FontSize="14"
FontWeight="Bold"
Foreground="Gray"
Text="Today - " />
<TextBlock
FontSize="14"
Foreground="Gray"
Text="0" />
</StackPanel>
<StackPanel
Margin="0,10,0,0"
HorizontalAlignment="Center"
Orientation="Horizontal">
<TextBlock
Margin="0,0,5,0"
FontSize="14"
FontWeight="Bold"
Foreground="Gray"
Text="Previous Tasks - " />
<TextBlock
FontSize="14"
Foreground="Gray"
Text="0" />
</StackPanel>
</StackPanel>
</StackPanel>
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
I have a DataTemplate which describes the Items of a ListBox in XAML. Into each Item I have four things:
1) a progress bar
2) three buttons
I noticed that when the progress bar is advancing, the buttons result to be unclickable, why?
There is my XAML code referring to the abovementioned ListBox:
<ListBox Grid.Column="1" Name="TransfersList" Margin="30,10,-0.444,34.889" ItemsSource="{Binding DataTx}"
SelectionChanged="TransfersList_SelectionChanged" Grid.Row="1" Grid.ColumnSpan="3"
HorizontalContentAlignment="Stretch">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<ProgressBar Height="20" Minimum="0" Maximum="{Binding NChunks}" Name="gasparino_il_carbonaro"
Value="{Binding PbStatus}" Foreground="{Binding Color}"
ToolTip="{Binding TooltipInfo}" />
<Button Content="Delete all" Grid.Column="3" Margin="0,0,0,0" Grid.Row="1" Height="20"
VerticalAlignment="Center" HorizontalAlignment="Left" Width="75" Background="White"
Click="DeleteAllTransfersClick" />
<Button Content="Stop all" Grid.Column="3" Margin="0,0,0,0" Grid.Row="1" Height="20"
VerticalAlignment="Center" HorizontalAlignment="Center" Width="75" Background="White"
Click="StopAllTransfersClick" />
<Button Content="Resume all" Grid.Column="3" Margin="0,0,0,0" Grid.Row="1" Height="20"
VerticalAlignment="Center" HorizontalAlignment="Right" Width="75" Background="White"
Click="ResumeAllTransfersClick" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
It happens in Single threaded application. To use multi threaded concept, show progress bar using using event & delegates.
How can I create a multicolumn ListView/ListBox in WPF with good performance. I know how to do it with WrapPanel. In the ListBox I have about 70-150 items and scrolling is laggy/not so fluent (like with VirtualStackPanel). Do you know how to solve this problem?
Thank you
Here is ListBox XAML
<ListBox x:Name="ListBoxSubtitles" VirtualizingStackPanel.IsVirtualizing="True" Margin="0,0,0,0" ItemsSource="{Binding Subtitle,Mode=TwoWay}" Grid.Row="1" ScrollViewer.HorizontalScrollBarVisibility="Disabled" BorderBrush="{x:Null}" Background="#FFEEECEC"
>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Width="520" Height="150" Background="#FF424242" Margin="5,5,5,0">
<Grid.RowDefinitions>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="85"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Image Source="{Binding PosterImgUri,Mode=TwoWay}" Grid.ColumnSpan="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Stretch="UniformToFill">
<Image.Effect>
<BlurEffect Radius="40" />
</Image.Effect>
</Image>
<Image Width="75" Height="110" Grid.Column="0" Margin="2,2,2,2" VerticalAlignment="Top" HorizontalAlignment="Stretch" Source="{Binding PosterImgUri,Mode=TwoWay}" Stretch="Fill"/>
<Label Grid.Column="0" Content="86%" HorizontalAlignment="Center" Margin="0,0,0,0" VerticalAlignment="Bottom" Background="{x:Null}" Foreground="White" FontFamily="Segoe UI Semibold" FontSize="18" FontWeight="Bold"/>
<StackPanel Grid.Column="1">
<Label HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top" Background="{x:Null}" Foreground="White" FontFamily="Segoe UI Semibold" FontSize="25" FontWeight="Bold">
<TextBlock TextWrapping="Wrap" Text="{Binding SubtitleName,Mode=TwoWay}">
</TextBlock>
</Label>
<Grid>
<Label Content="Stažení:" HorizontalAlignment="Left" Margin="0,-7,0,0" VerticalAlignment="Top" Background="{x:Null}" Foreground="White" FontFamily="Segoe UI Light" FontSize="18"/>
<Label Content="{Binding subtitleName,Mode=TwoWay}" HorizontalAlignment="Left" Margin="65,-7,0,0" VerticalAlignment="Top" Background="{x:Null}" Foreground="White" FontFamily="Segoe UI Light" FontSize="18"/>
</Grid>
<Grid Width="100" Height="20" Margin="0,0,0,0" HorizontalAlignment="Left">
<ProgressBar Value="50" HorizontalAlignment="Stretch" VerticalContentAlignment="Stretch" Margin="7,0,0,0" Foreground="#FF84E60F" Background="White"/>
<Label Margin="0,-2,0,0" HorizontalAlignment="Center" VerticalAlignment="Center" Content="50" FontSize="10" FontWeight="Bold"></Label>
</Grid>
</StackPanel>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
also I would like to ask, how to remove this blue selection when mouse is focusing item.
You need a virtualizing wrap panel. Unfortunately, writing such kind of panel is not easy and most good implementations are either not free or not working for arbitrary complex data templates.
You can make the image bindings async, using the IsAsync property.
Another approach is to reduce the visual tree, which is not an option, because you go after quality. You can move the layout from the DataTemplate into a dedicated UserControl and load the images only when the control is visible (VisibilityChanged event or rectangle intersect based).
I have been up and down looking on the internet and many people seem to have this problem but its generally solved by changing the container to a grid, constraining the height etc. etc. I can't to seem to get this to work.
I have an observableCollection thats feeding into a DataTemplate. I can't for th life of me get the scrollbar working. Its there but not enabling. Thanks Scott
<TabItem Header="select a call" x:Name="TabActiveCalls" Style="{DynamicResource MyTabItem}" FontFamily="QuickType">
<Grid Margin="0.125,0.412,3.125,0" Height="471" HorizontalAlignment="Stretch">
<StackPanel Orientation="Horizontal" Width="839.14" HorizontalAlignment="Left" VerticalAlignment="Top" Height="56">
<StackPanel Orientation="Vertical" HorizontalAlignment="Left" Margin="0,0,10,0" Width="741.14">
<StackPanel Height="28" Orientation="Horizontal" Width="733.14" HorizontalAlignment="Left">
<TextBlock x:Name="txtHistoryFound" TextWrapping="Wrap" Text="*" Foreground="#FFE20A0A" Visibility="Collapsed"/>
<TextBlock TextWrapping="Wrap" Text="filter by:" Margin="5,0,10,0" Foreground="#FF585AD4" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<TextBlock TextWrapping="Wrap" Text="call no" Margin="5,0,2,0" VerticalAlignment="Center" Foreground="#FF5E88DA"/>
<TextBox Template="{StaticResource TextBoxBaseControlTemplate}" x:Name="searchCallNo" TextChanged="searchCallNo_TextChanged" TextWrapping="Wrap" Width="67" Foreground="#FF1341B1" TextAlignment="Center" Margin="5,0,10,0" Height="22" VerticalAlignment="Center" />
<TextBlock TextWrapping="Wrap" Text="postcode" Margin="5,0,2,0" VerticalAlignment="Center" Foreground="#FF5E88DA"/>
<TextBox Template="{StaticResource TextBoxBaseControlTemplate}" x:Name="searchPostcode" TextWrapping="Wrap" Width="67" Foreground="#FF1341B1" TextAlignment="Center" Margin="5,0,10,0" Height="22" VerticalAlignment="Center"/>
<TextBlock Height="23" x:Name="txtSiteName" FontSize="16" Foreground="#FF0E7C0B" Width="409" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0" TextAlignment="Right" Text="Airedale International Ltd" />
</StackPanel>
<StackPanel Width="733.14" HorizontalAlignment="Left">
<Border Height="21" Margin="5,6,8,0" CornerRadius="3,3,0,0" BorderThickness="1" BorderBrush="#FFC0BABA">
<StackPanel Orientation="Horizontal" Background="#FFD0D5DE">
<TextBlock TextWrapping="Wrap" Text="CALL NO. / DATE DUE/ CUSTOMER" Margin="5,0,0,0" Foreground="{DynamicResource ListTitle}" FontSize="10.667" VerticalAlignment="Center"/>
<TextBlock TextWrapping="Wrap" Text="ENGINEER / ADDRESS" Margin="114,0,0,0" Foreground="{DynamicResource ListTitle}" VerticalAlignment="Center"/>
<TextBlock TextWrapping="Wrap" Text="REPORT" Margin="43,0,0,0" Foreground="{DynamicResource ListTitle}" RenderTransformOrigin="2.543,0.429" VerticalAlignment="Center"/>
<TextBlock TextWrapping="Wrap" Text="CALL" Margin="28,0,0,0" Foreground="{DynamicResource ListTitle}" RenderTransformOrigin="2.543,0.429" VerticalAlignment="Center"/>
<TextBlock TextWrapping="Wrap" Text="POSITION" Margin="43,0,0,0" Foreground="{DynamicResource ListTitle}" RenderTransformOrigin="2.543,0.429" VerticalAlignment="Center"/>
</StackPanel>
</Border>
</StackPanel>
</StackPanel>
<Image Height="56" Width="90" Source="/ComfortReportEng;component/Media/Images/comfort_group.png"/>
</StackPanel>
<ListBox ItemTemplate="{StaticResource DataTemplateReportList}" ItemsSource="{Binding Source={StaticResource cvsReportList}}"
Margin="5,56,8,0" MaxHeight="415" Height="415" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.CanContentScroll="True"/>
</Grid>
</TabItem>
many thanks for getting back. Here is my DataTempate
<DataTemplate x:Key="DataTemplateReportList">
<Border Margin="0,2,0,0" BorderThickness="1" BorderBrush="#FFA19C9C" CornerRadius="3,3,0,0" Width="810.52" Height="50" >
<Grid Background="#FF737B89" Height="48" >
<StackPanel Orientation="Vertical" HorizontalAlignment="Left" Width="274" VerticalAlignment="Top" >
<StackPanel Height="23" Orientation="Horizontal" Margin="0">
<TextBlock TextWrapping="Wrap" Text="{Binding CallNo, Mode=TwoWay}" Foreground="#FF7DF51E" Margin="5,0,0,0" FontFamily="Verdana"/>
<TextBlock TextWrapping="Wrap" Text="{Binding DateDue, Mode=TwoWay, StringFormat=d}" Foreground="White" Margin="5,0,0,0" FontFamily="Verdana"/>
</StackPanel>
<StackPanel Height="23" Orientation="Horizontal">
<TextBlock TextWrapping="Wrap" Text="{Binding CompanyName, Mode=TwoWay}" Foreground="#FFFFEA00" Margin="5,0,0,0" FontFamily="Verdana"/>
</StackPanel>
</StackPanel>
<StackPanel HorizontalAlignment="Left" Width="456" Orientation="Vertical" Height="46" Margin="274,1,0,1" VerticalAlignment="Top">
<StackPanel Height="23" Orientation="Horizontal">
<TextBlock TextWrapping="Wrap" Text="{Binding EngineerName, Mode=TwoWay}" Foreground="#FFCAE5C6" Margin="5,0,0,0" FontFamily="Verdana" Width="140"/>
<TextBlock TextWrapping="Wrap" Text="{Binding ReportStatus, Mode=TwoWay}" Foreground="#FF7DF51E" Margin="20,0,0,0" FontFamily="Verdana" Width="50"/>
<TextBlock TextWrapping="Wrap" Text="{Binding CallStatus, Mode=TwoWay}" Foreground="#FF7DF51E" Margin="20,0,0,0" FontFamily="Verdana" Width="50"/>
<TextBlock TextWrapping="Wrap" Text="{Binding Position, Mode=TwoWay}" Foreground="White" Margin="20,0,0,0" FontFamily="Verdana" Width="50"/>
</StackPanel>
<StackPanel Height="23" Orientation="Horizontal">
<TextBlock TextWrapping="Wrap" Text="{Binding Address, Mode=TwoWay}" Foreground="#FFFFEA00" Margin="5,0,0,0" FontFamily="Verdana" Width="483.12"/>
</StackPanel>
</StackPanel>
<Grid Width="56" HorizontalAlignment="Right" Margin="0,0,12.52,0" VerticalAlignment="Top">
<Image Name="imgInfo" Source="/ComfortReportEng;component/Media/Images/Info4.png" Margin="24,8,0,0" Cursor="Hand" MouseLeftButtonDown="imgInfo_MouseLeftButtonDown"/>
</Grid>
</Grid>
</Border>
</DataTemplate>
Must be a bug. I have the following only..
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="ComfortReportEng.Views.EngineerReport.EngineerReport"
Title="Engineer Report" WindowStartupLocation="CenterScreen" Loaded="Window_Loaded" SizeToContent="WidthAndHeight" >
<Window.Resources>
<CollectionViewSource x:Key="cvsReportList"/>
</Window.Resources>
<Grid Margin="0.125,0.412,3.125,0" Height="471">
<ListBox Margin="23,64,3,0" Width="834.14" ItemsSource="{Binding Source={StaticResource cvsReportList}}"
x:Name="lbReportList" SelectionChanged="lbReportList_SelectionChanged" Background="#FFEEEFE4" />
</Grid>
and code is
private void LoadReportList()
{
int number = 0;
List<int> myNumbers = new List<int>();
while (number < 80)
{
myNumbers.Add(number);
number += 1;
}
_cvsReportList = (CollectionViewSource)(this.FindResource("cvsReportList"));
_cvsReportList.Source = myNumbers;
}
This was copied over from another project. Completely confused. Please don't worry. It's not a logical problem. Please take this as a close call with no solution. Cheers again Scott
Just to give this completeness. I am not sure why this happens but here is it.
if (System.Environment.MachineName == "SCOTT-PC")
{
this.txtUserName.Text = "Scott Fisher";
this.txtPassword.Password = "palace";
//LoginOK();
}
else
Keyboard.Focus(this.txtUserName);
If I clear the comments on LoginOK procedure I will get no scrollbar. With it commented and I interact with the login screen then everything is fine. Finally here is the code for the LoginOK.
if (LoginService.CheckLogin(txtUserName.Text, txtPassword.Password.ToString()))
{
Helpers.User.ThisUser = this.txtUserName.Text;
EngineerReport.EngineerReport engReport = new EngineerReport.EngineerReport()
{
Owner = Window.GetWindow(this),
WindowStartupLocation =
System.Windows.WindowStartupLocation.
CenterOwner
};
this.Hide();
engReport.ShowDialog();
}
else
{
this.txtPassword.Password = "";
this.txtPassword.Focus();
}
Can you provide you DataTemplate as I believe I have just managed to mock up what you are trying to achieve and I have scrollbars visible and working form the start.
Here is the xaml that I used for the DataTemplate for the ListBox:
<ListBox DataContext="{StaticResource MusicData}" ItemsSource="{Binding XPath=Album}">
<ListBox.ItemTemplate>
<DataTemplate>
<ListBoxItem>
<StackPanel Orientation="Horizontal" >
<TextBlock>No.</TextBlock>
<TextBlock Text="{Binding XPath=No}"></TextBlock>
<TextBlock>Title</TextBlock>
<TextBlock Text="{Binding XPath=Title}"></TextBlock>
</StackPanel>
</ListBoxItem>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
Hope this helps.
I also found a piece of code I used a while back and this might help. You can try setting the ItemsPanelTemplate:
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel>
<ScrollViewer VerticalScrollBarVisibility="Visible" />
</StackPanel>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
This will work with any items control as stated in this article:
http://msdn.microsoft.com/en-us/library/system.windows.controls.itemscontrol.itemcontainerstyle.aspx
One final thing I can suggest is to create your own ControlTemplate for the ListBox Like so:
<ListBox.Template>
<ControlTemplate>
<ScrollViewer VerticalScrollBarVisibility="Auto">
<ItemsPresenter />
</ScrollViewer>
</ControlTemplate>
</ListBox.Template>
I have data binding to a listbox, and texttrimming property set to WordEllipsis, but it doesn't seem to work. The textblocks are showing text as if they do without the texttrimming property set. This is my xaml code. Please help.
<Grid>
<Grid.Resources>
<application:ViewModel x:Key="ViewModel"/>
</Grid.Resources>
<TextBlock Height="75" TextWrapping="Wrap" Text="Click on Settings to search for quotes (by author or by query)." VerticalAlignment="Top" TextAlignment="Center" FontSize="26.667"/>
<ListBox Margin="0,166,0,0" Name="lstQuote" DoubleTap="lstQuote_DoubleTap" Hold="lstQuote_Hold">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<es:RegularPolygon Fill="#FFF4F4F5" Height="90" InnerRadius="0.47211" PointCount="5" Stretch="Fill" Stroke="Black" UseLayoutRounding="False" Width="84"/>
<StackPanel Orientation="Vertical" Margin="0,10,0,0">
<TextBlock Text="{Binding Author}" TextWrapping="Wrap" FontSize="24"/>
<TextBlock Text="{Binding Quote}" TextWrapping="NoWrap" FontSize="30" TextTrimming="WordEllipsis" Width="Auto" />
</StackPanel>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Button Content="Random Quote" Height="79" Margin="48,83,44,0" VerticalAlignment="Top" x:Name="quotSearch" Click="quotSearch_Click" />
</Grid>
change TextBox Width properties to fixed width
<TextBlock Width="200" Height="75" TextWrapping="Wrap" Text="Click on Settings to search for quotes (by author or by query)." VerticalAlignment="Top" TextAlignment="Center" FontSize="26.667"/>