WPF main left height 100%, main right height 100% and footer - wpf

I have created the following design with main left, main right and footer.
However I want main left to be height 100%, so that the dark gray background color goes all the way down to the footer.
I've tried to set height=*, but it doesnt help.
My design:
NewProjectWindow.xaml
<Window x:Class="QuickImageForensicsWPF.NewProject.NewProjectWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:QuickImageForensicsWPF.NewProject"
mc:Ignorable="d"
Title="New Project | Quick Image Forensics" Height="{DynamicResource {x:Static SystemParameters.MaximizedPrimaryScreenHeightKey}}" Width="{DynamicResource {x:Static SystemParameters.MaximizedPrimaryScreenWidthKey}}" Top="0" Left="0">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="..\res\style\Btn.xaml" />
<ResourceDictionary Source="..\res\style\Input.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Grid Background="#FF45474A">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- Main -->
<StackPanel x:Name="stackPanelMain" Grid.Row="0" Grid.Column="0" >
<Grid Background="#FF45474A">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="400" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel x:Name="stackPanelLeft" Grid.Row="0" Grid.Column="0" Background="#FF393939" Margin="0,0,20,0">
<!-- Left content -->
<Label x:Name="labelProjects" Content="New project" Margin="0,20,0,0" FontSize="16" Foreground="#FFBABAA8" FontWeight="Bold"/>
<Label x:Name="labelNewProjectStep01" Content="Project information" Margin="0,0,0,0" FontSize="14" Foreground="#FFBABAA8" FontStyle="Italic" />
<Label x:Name="labelNewProjectStep02" Content="Automated tasks" Margin="0,0,0,0" FontSize="14" Foreground="#FFBABAA8" />
<Label x:Name="labelNewProjectStep03" Content="Search" Margin="0,0,0,0" FontSize="14" Foreground="#FFBABAA8" />
<!-- //Left content -->
</StackPanel>
<StackPanel x:Name="stackPanelRight" Grid.Row="0" Grid.Column="1">
<!-- Right content -->
<DockPanel x:Name="dockPanelMain" LastChildFill="False">
<local:NewProjectStep01ProjectInformationUserControl x:Name="newProjectStep01ProjectInformationUserControl" Panel.ZIndex="0" />
<local:NewProjectStep02AutomatedTasksUserControl x:Name="NewProjectStep02AutomatedTasksUserControl" Panel.ZIndex="1" />
<local:NewProjectStep03SearchUserControl x:Name="NewProjectStep03SearchUserControl" Panel.ZIndex="2" />
</DockPanel>
<!-- //Right content -->
</StackPanel>
</Grid>
</StackPanel>
<!-- //Main -->
<!-- Footer -->
<StackPanel x:Name="stackPanelFooter" Grid.Row="1" Grid.Column="0">
<Border BorderBrush="#FF323232" BorderThickness="1" DockPanel.Dock="Top" Padding="0,0,0,0">
<Grid Background="#FF45474A">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="400" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="1" Orientation="Horizontal" Margin="0,20,0,20">
<Button x:Name="buttonPrevious" Content=" Previous " VerticalAlignment="Bottom" Click="buttonPrevious_Click" Style="{StaticResource btn_default}" HorizontalAlignment="Left" Margin="0,0,10,0" />
<Button x:Name="buttonNext" Content=" Next " VerticalAlignment="Bottom" Click="buttonNext_Click" Style="{StaticResource btn_default_success}" HorizontalAlignment="Left" />
</StackPanel>
</Grid>
</Border>
</StackPanel>
<!-- //Footer -->
</Grid>
</Window>
The program is C# WPF with .NETFramework v4.7.2.

For Main, I replaced stackpanel with Grid layout and added VerticalAlignment="Stretch".
<Grid x:Name="stackPanelMain" Grid.Row="0" Grid.Column="0" VerticalAlignment="Stretch" >
<Grid Background="#FF45474A" VerticalAlignment="Stretch" >
<Grid.RowDefinitions>
<RowDefinition Height="400*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="400" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel x:Name="stackPanelLeft" Grid.Row="0" Grid.Column="0" Background="#FF393939" Margin="0,0,20,0">
<!-- Left content -->
<Label x:Name="labelProjects" Content="New project" Margin="0,20,0,0" FontSize="16" Foreground="#FFBABAA8" FontWeight="Bold"/>
<Label x:Name="labelNewProjectStep01" Content="Project information" Margin="0,0,0,0" FontSize="14" Foreground="#FFBABAA8" FontStyle="Italic" />
<Label x:Name="labelNewProjectStep02" Content="Automated tasks" Margin="0,0,0,0" FontSize="14" Foreground="#FFBABAA8" />
<Label x:Name="labelNewProjectStep03" Content="Search" Margin="0,0,0,0" FontSize="14" Foreground="#FFBABAA8" />
<!-- //Left content -->
</StackPanel>
<StackPanel x:Name="stackPanelRight" Grid.Row="0" Grid.Column="1">
<!-- Right content -->
<DockPanel x:Name="dockPanelMain" LastChildFill="False">
<!--<local:NewProjectStep01ProjectInformationUserControl x:Name="newProjectStep01ProjectInformationUserControl" Panel.ZIndex="0" />
<local:NewProjectStep02AutomatedTasksUserControl x:Name="NewProjectStep02AutomatedTasksUserControl" Panel.ZIndex="1" />
<local:NewProjectStep03SearchUserControl x:Name="NewProjectStep03SearchUserControl" Panel.ZIndex="2" />-->
</DockPanel>
<!-- //Right content -->
</StackPanel>
</Grid>
</Grid>

Related

WPF telerik RadRibbonView and RadRibbonWindow

I am using Telerik WPF UI RadRibbonWindow, RadRibbonView in my application. I have inherited RadRibbonWindow in the MainWindow class. I have added the proper Dlls for that with same version, but the control is not visible in Window. How can I solve this visibility problem? The project is building successfully.
<telerik:RadRibbonWindow x:Class="WpfApplication2.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApplication2"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="25"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="3*"/>
</Grid.ColumnDefinitions>
<telerik:RadRibbonView x:Name="theRibbon" Grid.Row="0" Grid.ColumnSpan="3">
<!-- Ribbon Tab #1: Home -->
<telerik:RadRibbonTab Header="Home" telerik:KeyTipService.AccessText="H">
<telerik:RadRibbonGroup Header="Clipboard">
<telerik:RadRibbonButton LargeImage="/Resources/Icons/cut.png" Text="Cut"/>
<telerik:RadRibbonButton LargeImage="/Resources/Icons/paste.png" Text="Paste" />
<telerik:RadRibbonButton LargeImage="/Resources/Icons/copy.png" Text="Copy" />
</telerik:RadRibbonGroup>
<telerik:RadRibbonGroup Header="Show">
<telerik:RadRibbonButton Text="Close Table" Size="Large"
LargeImage="/Resources/Icons/closetable.png"/>
<telerik:RadRibbonButton Text="Close All" Size="Large"
LargeImage="/Resources/Icons/closeall.png"/>
<!--<Fluent:Button Header="Close Table" Click="CloseTable_Click" SizeDefinition="Large, Middle, Small"
Icon="/Resources/Icons/closetable.png" LargeIcon="/Resources/Icons/closetable.png"/>-->
<StackPanel Orientation="Horizontal" Margin="2">
<CheckBox IsChecked="True"
VerticalAlignment="Center" HorizontalAlignment="Center" Width="15" Height="15"
/>
<telerik:Label Content="Status bar" Padding="0" Margin="5,0,0,0"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="2">
<CheckBox VerticalAlignment="Center" IsChecked="True"
HorizontalAlignment="Center" Width="15" Height="15">
</CheckBox>
<telerik:Label Content="Folder list" Padding="0" Margin="5,0,0,0"/>
</StackPanel>
</telerik:RadRibbonGroup>
<telerik:RadRibbonGroup Header="Publish">
<telerik:RadRibbonButton Name="printBtn" LargeImage="/Resources/Icons/print.png" Text="Print..." telerik:KeyTipService.AccessText="P" />
<telerik:RadRibbonButton Name="exportBtn" LargeImage="/Resources/Icons/export.png" Text="Export..." telerik:KeyTipService.AccessText="E" />
</telerik:RadRibbonGroup>
<telerik:RadRibbonGroup Header="Edit">
<telerik:RadToggleButton Name="lockBtn" />
<telerik:RadRibbonButton Name="appendRowBtn" Size="Large, Medium, small" SmallImage="/Resources/Icons/appendrow.png"
LargeImage="/Resources/Icons/appendrow.png" Text="Append Row" />
<telerik:RadRibbonButton Name="addAboveBtn" LargeImage="/Resources/Icons/addabove.png"
Text="Add Above" VerticalContentAlignment="Center"/>
<telerik:RadRibbonButton Name="addBelowBtn" LargeImage="/Resources/Icons/addbelow.png" Text="Add Below" />
<telerik:RadRibbonButton Name="deleteRowBtn" LargeImage="/Resources/Icons/deleterow.png" Text="Delete Row" />
<telerik:RadRibbonButton Name="commitBtn" Size="Medium" SmallImage="/Resources/Icons/commit.png" Text="Commit" />
<telerik:RadRibbonButton Name="rollbackBtn" Size="Medium" SmallImage="/Resources/Icons/commit.png" Text="Rollback"/>
</telerik:RadRibbonGroup>
<telerik:RadRibbonGroup Header="Font">
<StackPanel Orientation="Horizontal" Margin="2,5">
<telerik:RadComboBox Name="fontComboBox" Width="120" Margin="0" IsEditable="True"
ToolTip="Font" SelectedIndex="0"
IsReadOnly="True" >
<telerik:RadComboBoxItem Content="Time New Roman"/>
<telerik:RadComboBoxItem Content="Arial"/>
<telerik:RadComboBoxItem Content="Century Gothic"/>
<telerik:RadComboBoxItem Content="Comic Sans MS"/>
<telerik:RadComboBoxItem Content="Calibri"/>
</telerik:RadComboBox>
<telerik:RadComboBox Name="fontSizeComboBox" Width="40"
ToolTip="Font Size"
SelectedIndex="1"
IsReadOnly="True"
IsEditable="True"
Margin="0" >
<telerik:RadComboBoxItem Content="10"/>
<telerik:RadComboBoxItem Content="12"/>
<telerik:RadComboBoxItem Content="14"/>
<telerik:RadComboBoxItem Content="16"/>
<telerik:RadComboBoxItem Content="18"/>
</telerik:RadComboBox>
<StackPanel Orientation="Horizontal" Margin="2">
<CheckBox Name="AltCheckBox" Width="20" VerticalAlignment="Center" />
<TextBlock VerticalAlignment="Center" Text="Alternate"/>
</StackPanel>
</StackPanel>
</telerik:RadRibbonGroup>
<telerik:RadRibbonGroup Header="Search">
<TextBox x:Name="searchBox" FocusManager.IsFocusScope="True" Margin="2"
HorizontalAlignment="Right" VerticalAlignment="Center" />
</telerik:RadRibbonGroup>
</telerik:RadRibbonTab>
</telerik:RadRibbonView>
and I am inheriting as:
public partial class MainWindow :RadRibbonWindow { public MainWindow () { InitializeComponent (); }
dlls added by me:
Telerik.Windows.Controls, Telerik.Windows.Controls.Input, Telerik.Windows.Controls.Navigation, Telerik.Windows.Controls.RibbonView, I have added these assemblies with same versions. 2016.2.613.45 And I am Using VS2013 Telerik.Windows.Controls.Data,
what changes should i made in code so that RadRibbonWindow will be visible in mainWindow, here I have created WPF Application project.

Flickering and blurry text

I have an issue with a text. In some custom usercontrols it is flickering every more/less second (probably when rendering) here is a gif:
I'm using these render and text options for now which are applied on Window:
RenderOptions.ClearTypeHint="Enabled"
TextOptions.TextFormattingMode="Display"
RenderOptions.BitmapScalingMode="HighQuality"
I was using these before:
RenderOptions.ClearTypeHint="Enabled"
RenderOptions.BitmapScalingMode="Linear"
TextOptions.TextRenderingMode="Grayscale"
TextOptions.TextFormattingMode="Display"
and it was ok but the text was too sharp.
XAML of this specific component:
<UserControl x:Class="FunctionButton" x:Name="PART_Base"
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:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm" xmlns:ViewModels="clr-namespace:SkyPCTool"
xmlns:materialDesign="clr-namespace:MaterialDesignThemes.Wpf;assembly=MaterialDesignThemes.Wpf"
mc:Ignorable="d"
TextElement.FontWeight="Medium"
TextElement.FontSize="14"
FontFamily="pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto"
MinHeight="52" d:DesignWidth="300" Margin="0">
<UserControl.DataContext>
<ViewModels:FunctionButtonViewModel/>
</UserControl.DataContext>
<UserControl.Resources>
<ViewModels:TextToVisibilityConverter x:Key="textConverter" />
</UserControl.Resources>
<Border CornerRadius="2" Background="{StaticResource MaterialDesignPaper}">
<Grid Margin="12,6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="3*" />
</Grid.ColumnDefinitions>
<Button x:Name="PART_Button" HorizontalAlignment="Center" VerticalAlignment="Center" Padding="12,6" Content="{Binding ButtonCaption}" />
<Grid Grid.Column="1" Margin="6,0">
<Image Source="{Binding Icon}" ToolTip="{Binding IconTag}" />
</Grid>
<Grid Grid.Column="2" SnapsToDevicePixels="True">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="{Binding Title}" RenderOptions.ClearTypeHint="Enabled" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" FontSize="14" />
<TextBlock Grid.Row="1" Text="{Binding Description}" RenderOptions.ClearTypeHint="Enabled" Margin="12,0,0,0" Visibility="{Binding Text, RelativeSource={RelativeSource Self}, Converter={StaticResource textConverter}}" FontWeight="Normal" VerticalAlignment="Center" TextWrapping="Wrap" FontSize="12.667" />
</Grid>
</Grid>
</Border>
I did it. I downloaded the Roboto font from Google website, then I set these options on Window:
RenderOptions.ClearTypeHint="Enabled"
TextOptions.TextFormattingMode="Ideal"
TextOptions.TextHintingMode="Animated"
TextOptions.TextRenderingMode="ClearType"

WPF: RichTextBox outside of window

There is Usercontrol with RichTextBox.
When user adds a text then bottom of RTB moves outside of window.
How to fit RTB to window and to do vertical scroll bar?
<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:ServiceProcess.Helpers.Controls"
x:Class="ServiceProcess.Helpers.Views.ServiceView"
x:ClassModifier="internal"
Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<UserControl.Resources>
<BooleanToVisibilityConverter x:Key="boolToVis" />
</UserControl.Resources>
<StackPanel VerticalAlignment="Stretch" HorizontalAlignment="Stretch" >
<Grid HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="100" />
<ColumnDefinition Width="100" />
<ColumnDefinition Width="20" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Margin="2"
Grid.Row="0" Grid.Column="0"
Text="{Binding Name}" />
<TextBlock Margin="2"
Grid.Row="0" Grid.Column="1"
Text="{Binding CurrentState}" HorizontalAlignment="Left"/>
<controls:GifImage Grid.Row="0" Grid.Column="2"
AnimationSource="pack://application:,,,/ServiceProcess.Helpers;component/Images/spinner.gif"
Stretch="None"
Visibility="{Binding Path=IsBusy, Converter={StaticResource boolToVis}}" />
</Grid>
<RichTextBox Name="rtb"
Height="Auto" Width="Auto"
HorizontalAlignment="Stretch"
Margin="6,6,0,0"
VerticalAlignment="Stretch"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Auto" >
<FlowDocument Name="rtbFlowDoc" PageWidth="{Binding ElementName=rtb, Path=ActualWidth}" >
<Paragraph FontSize="14">Hello, world!</Paragraph>
<Paragraph FontStyle="Italic" TextAlignment="Left" FontSize="12" Foreground="Gray">Thanks to the RichTextBox control, this FlowDocument is completely editable!</Paragraph>
</FlowDocument>
</RichTextBox>
</StackPanel>
</UserControl>
I am trying to add RTB to the free space of this window to display log messages
http://windowsservicehelper.codeplex.com/
If I understand it correctly from your code, this is inside a template of a ListView's item.
In ServicesControllerView.xaml add ScrollViewer.CanContentScroll="False" to the ListView.

Silverlight, XAML, DataGrid does not autosize, no auto scrollbars

Can anyone tell me why the datagrid in this example gets cut off when it grows past the bounds of the Grid.Row which contains it? Here is the xaml and code-behind which you can use in a VS 2010 'Silverlight Application' template. Thanks in advance.
<UserControl
x:Class="SilverlightApplication3.MainPage"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
mc:Ignorable="d" >
<Grid>
<Border>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- header -->
<Border Grid.Row="0" HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="40" >
</Border>
<!-- employee category selection -->
<Grid Grid.Row="1" Margin="10">
<StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Category:" Margin="0,0,10,0" VerticalAlignment="Center" />
<ComboBox ItemsSource="{Binding EmployeeTypes}" SelectedItem="{Binding EmployeeType, Mode=TwoWay}" MinWidth="100" />
</StackPanel>
<Border BorderBrush="Black" BorderThickness="10" Height="2" Margin="0,10,0,0" ></Border>
</StackPanel>
</Grid>
<!-- content -->
<Grid Grid.Row="2">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- daily employee grid -->
<Grid Grid.Row="0" Visibility="Visible" Margin="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0">
<TextBlock Text="Category Type:" />
<ComboBox ItemsSource="{Binding Categories}"
SelectedItem="{Binding Category, Mode=TwoWay}"
DisplayMemberPath="Name" HorizontalAlignment="Left" Width="250">
</ComboBox>
<TextBlock Text="Category Types:" Margin="0,10,0,0" />
<sdk:DataGrid x:Name="dataGrid" AutoGenerateColumns="True"
HorizontalAlignment="Left" VerticalAlignment="Stretch" MinWidth="250" VerticalScrollBarVisibility="Visible" >
<sdk:DataGrid.ColumnHeaderStyle>
<Style TargetType="sdk:DataGridColumnHeader">
<Setter Property="FontWeight" Value="Bold"/>
</Style>
</sdk:DataGrid.ColumnHeaderStyle>
</sdk:DataGrid>
</StackPanel>
</Grid>
</Grid>
<!-- buttons -->
<StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,10,0,0" >
<Button Command="{Binding SaveCommand}"
Width="80" HorizontalContentAlignment="Center" Margin="0,0,2,0">
<StackPanel Orientation="Horizontal">
<Image Source="../Images/Approve24x24.png" Height="24" Width="24"/>
<TextBlock Text="Save" VerticalAlignment="Center" Margin="2"/>
</StackPanel>
</Button>
<Button Command="{Binding CancelCommand}"
Width="80" HorizontalContentAlignment="Center">
<StackPanel Orientation="Horizontal">
<Image Source="../Images/Delete24x24.png" Height="24" Width="24"/>
<TextBlock Text="Cancel" VerticalAlignment="Center" Margin="2"/>
</StackPanel>
</Button>
</StackPanel>
</Grid>
</Border>
</Grid>
and the code-behind:
using System.Collections.Generic;
using System.Windows.Controls;
namespace SilverlightApplication3
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
List<string> testItems = new List<string>();
for (int i = 0; i < 50; i++)
{
testItems.Add(string.Format("Item Number {0}", i.ToString()));
}
this.dataGrid.ItemsSource = testItems;
}
}
}
You used the StackPanel to display some elements and datagrid. So here datagrid is not constrained to any height, moreover the the parent grid of stackpanel's height is Auto. So there is no where you are making grid to occupy fixed size.
I modified your code with in a grid.
<!-- content -->
<Grid Grid.Row="2">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- daily employee grid -->
<Grid Grid.Row="0" Visibility="Visible" Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="28" />
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel>
<TextBlock Text="Category Type:" />
<ComboBox ItemsSource="{Binding Categories}"
SelectedItem="{Binding Category, Mode=TwoWay}"
DisplayMemberPath="Name" HorizontalAlignment="Left" Width="250">
</ComboBox>
</StackPanel>
<TextBlock Text="Category Types:" Margin="0,10,0,0" Grid.Row="1" />
<sdk:DataGrid x:Name="dataGrid" AutoGenerateColumns="True" Grid.Row="2" ScrollViewer.VerticalScrollBarVisibility="Visible" Margin="10"
HorizontalAlignment="Left" VerticalAlignment="Top" MinWidth="250" VerticalScrollBarVisibility="Visible" >
<sdk:DataGrid.ColumnHeaderStyle>
<Style TargetType="sdk:DataGridColumnHeader">
<Setter Property="FontWeight" Value="Bold"/>
</Style>
</sdk:DataGrid.ColumnHeaderStyle>
</sdk:DataGrid>
</Grid>
</Grid>
This should give you the expected result.

forcing scrollbars to appear in listbox

Hi can I force scrollbars to appear in listbox when its content do not fit. I really need it.
To create tabcontrol item I concucted this xaml:
<TabControl.ContentTemplate>
<DataTemplate>
<ScrollViewer VerticalScrollBarVisibility="Visible"
HorizontalScrollBarVisibility="Visible">
<Grid Name="RssFeedContainerGrid" >
<Grid.RowDefinitions>
<RowDefinition Height="20" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<controls:ucRssFeed Grid.Row="1" RssUri="{Binding FeedUri}" />
</Grid>
</ScrollViewer>
</DataTemplate>
</TabControl.ContentTemplate>
and ucRssFeed contains listbox.
Here some xaml from that control where I want scrolling to take place:
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Margin="10" x:Name="RssFeedCellblock">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel Orientation="Vertical" Margin="10" Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="0">
<!-- Topic label-->
<TextBlock Cursor="Hand" FontWeight="Bold" Text="{Binding XPath=title}" Tag="{Binding XPath=link}" Foreground="{StaticResource RSS_Topic_Title}" MouseDown="TextBlock_MouseDown">
</TextBlock>
<!-- Breakline -->
<Line Stroke="{StaticResource RSS_Topic_Title}" Y1="5" Y2="5" X1="0" X2="{Binding ElementName=NewsListBox, Path=ActualWidth}" Opacity="0.7" StrokeThickness="1"/>
<!-- publication date label -->
<TextBlock Text="{Binding XPath=pubDate}" Opacity="0.5" />
<!-- Description textblock -->
<TextBlock FontSize="10" FontFamily="Times New Roman" x:Name="descriptionTextBlock"
Text="{Binding XPath=description, Converter={StaticResource HtmlToPlainTextConverter}}" Margin="10"
TextWrapping="Wrap" />
</StackPanel>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
You need to set the Height property of your ListBox for the Scrollbar to appear listbox automatically show scrollbar when the content is more

Resources