リージョン (Itemscontrol) に注入されるビューがあります。ビューは、コンテンツのサイズに応じて領域内のスペースのみを占有します。ビューが領域の高さ全体に伸びるようにしたい。これが私の見解のコードです:
<UserControl x:Name="userControl" x:Class="DishPromo.Modules.Payments.SideCart.SideCartView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:infUIFramework="clr-namespace:DishPromo.Infrastructure.UIFramework;assembly=DishPromo.Infrastructure"
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:Convert="clr-namespace:DishPromo.Modules.Payments.SideCart"
mc:Ignorable="d" >
<UserControl.Resources>
<Convert:ObjectToStringConverter x:Key="ToString" />
<Convert:BooleanToVisibilityConverter x:Key="ToVisibility" />
<Convert:WOMsgVisibilityConverter x:Key="WOMsgVisibility" />
<Convert:WorkOrderMsgConverter x:Key="WorkOrderMsg" />
<Convert:RescheduleValueConverter x:Key="ValueConverter" />
<Convert:PaymentAmountDueNow x:Key="PaymentAmountDueNow" />
<Style TargetType="Button" x:Key="hotkeyStyle">
<Setter Property="Width" Value="Auto"/>
<Setter Property="Height" Value="25"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid Background="Transparent">
<Border Name="border"
Padding="4,2" CornerRadius="3"
BorderBrush="DarkGray"
/>
<Rectangle x:Name="FVElement" Stretch="Fill" StrokeLineJoin="Miter" StrokeThickness="0.5" Opacity="0" RadiusX="2" RadiusY="2"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Fill="{StaticResource {x:Static SystemColors.ControlLightLightBrushKey}}" Stroke="{StaticResource OEFlowButtonBorderStyle}"
>
</Rectangle>
<Rectangle x:Name="Background" StrokeLineJoin="Miter" StrokeThickness="0.5" Opacity="1" Margin="2" RadiusX="3" RadiusY="3">
<Rectangle.Fill>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1" >
<GradientStop Color="{StaticResource {x:Static SystemColors.ControlColorKey}}" Offset="0.576" />
<GradientStop Color="{StaticResource {x:Static SystemColors.ControlLightLightColorKey}}" Offset="0" />
<GradientStop Color="{StaticResource {x:Static SystemColors.ControlColorKey}}" Offset="1" />
<GradientStop Color="{StaticResource {x:Static SystemColors.ControlLightColorKey}}" Offset="0.262" />
</LinearGradientBrush>
</Rectangle.Fill>
<Rectangle.Stroke>
<LinearGradientBrush EndPoint="0.5,-1.85" StartPoint="0.5,1.5">
<GradientStop Color="Black" Offset="0"/>
<GradientStop Color="Black" Offset="1"/>
</LinearGradientBrush>
</Rectangle.Stroke>
</Rectangle>
<Path x:Name="WhiteBand" Height="4.25" Stretch="Fill" StrokeLineJoin="Miter" Fill="{StaticResource OEFlowButtonWhiteBandFillStyle}"
Data="M4.2160064,2.75 C4.2160064,1.6454305 5.1114369,1.7153466 6.2160064,1.7153466 L22.679308,1.7153466 C23.783877,1.7153466 24.679308,1.6454305 24.679308,2.75 24.679308,2.75 4.2160064,2.75 4.2160064,2.75 z"
Margin="7,4,7,0" HorizontalAlignment="Center" VerticalAlignment="Top"/>
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black" FontWeight="Light"
TextWrapping="WrapWithOverflow" Text="{TemplateBinding Content}" x:Name="btnName" >
</TextBlock>
<ContentPresenter />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="BorderBrush" Value="#FF585151" />
<Setter Property="Cursor" Value="Hand" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" >
<Setter.Value>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1" >
<GradientStop Color="#FF219921" Offset="0.35"/>
<GradientStop Color="#FF216B99" Offset="1"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Setter Property="RenderTransform" >
<Setter.Value>
<TranslateTransform Y="0.5" />
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="border" Property="Opacity" Value="0.3" />
<Setter TargetName="Background" Property="Opacity" Value="0.3" />
<Setter TargetName="FVElement" Property="Opacity" Value="0.3" />
<Setter TargetName="btnName" Property="Foreground" Value="Gray"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<DockPanel VerticalAlignment="Stretch" LastChildFill="True" >
<DockPanel.InputBindings>
<KeyBinding Command="{Binding MinPaymentOverride}" Gesture="SHIFT+CTRL+y"></KeyBinding>
<KeyBinding Command="{Binding PIAMinPaymentOverride}" Gesture="SHIFT+CTRL+m"></KeyBinding>
<KeyBinding Command="{Binding EFTOverride}" Gesture="SHIFT+CTRL+e"></KeyBinding>
<KeyBinding Command="{Binding CCOverride}" Gesture="SHIFT+CTRL+c"></KeyBinding>
<KeyBinding Command="{Binding OverrideCC}" Gesture="SHIFT+CTRL+c"></KeyBinding>
<KeyBinding Command="{Binding OverrideSSN}" Gesture="SHIFT+CTRL+s"></KeyBinding>
<KeyBinding Command="{Binding OverrideCertificate}" Gesture="SHIFT+CTRL+j"></KeyBinding>
<KeyBinding Command="{Binding OverrideSellingAgent}" Gesture="SHIFT+CTRL+d"></KeyBinding>
<KeyBinding Command="{Binding OverrideRefCompany}" Gesture="SHIFT+CTRL+i"></KeyBinding>
<KeyBinding Command="{Binding OverrideSellingCompany}" Gesture="SHIFT+CTRL+n"></KeyBinding>
</DockPanel.InputBindings>
<DockPanel.Style>
<Style>
<Style.Triggers>
<DataTrigger Binding="{Binding ChangeFocus}" Value="True">
<Setter Property="FocusManager.FocusedElement" Value="{Binding ElementName=SidecartRemove}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</DockPanel.Style>
<!--<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>-->
<DockPanel x:Name="dpNotificationArea" Margin="0" VerticalAlignment="Bottom" AllowDrop="True" LastChildFill="True" >
<!--<Grid.RowDefinitions>
<RowDefinition MinHeight="350" />
<RowDefinition Height="29"/>
<RowDefinition Height="58"/>
<RowDefinition Height="27"/>
</Grid.RowDefinitions>-->
<Grid Grid.Row="3" VerticalAlignment="Bottom" DockPanel.Dock="Bottom">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="260"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Width="Auto" FontWeight="Bold" Foreground="Red">
<MultiBinding Converter="{StaticResource PaymentAmountDueNow}">
<Binding Path="CustomerModel.AccountInfo.Pricer.PaymentRequired"/>
<Binding Path="CustomerModel.AccountInfo.AccountStatus"/>
</MultiBinding>
</Label>
<StackPanel Grid.Column="1" x:Name="spPricerActionBar" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Right">
<Button Style="{StaticResource hotkeyStyle}" Width="80" x:Name="SidecartRemove" Command="{Binding RemoveCartItem}"
IsEnabled="{Binding CustomerModel.ControlStatus.RemoveIsEnabled}" GotFocus="SidecartRemove_GotFocus">
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black" FontWeight="Light"><Run Text="Re"/><Underline><Run Text="m"/></Underline><Run Text="ove"/></TextBlock>
</Button>
<Button x:Name="btnFeeWaived" Width="80" Content="Fees Waived" IsEnabled="{Binding IsFeeWaivedEnabled}"
Command="{Binding ShowBattery}" GotFocus="btnFeeWaived_GotFocus" />
<Button Width="100" Content="Price It" HorizontalAlignment="Right" Visibility="{Binding PriceItVisibility}" Command="{Binding GetPricing}" Background="#FF6633" Style="{StaticResource PriceItStyle}"/>
</StackPanel>
</Grid>
<StackPanel x:Name="spWorkOrder" Grid.Row="2" VerticalAlignment="Bottom" DockPanel.Dock="Bottom">
<Grid Margin="0,0,0,6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="75" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
</Grid.RowDefinitions>
<StackPanel Grid.Column="1" VerticalAlignment="Bottom">
<Button Width="70" Height="25" x:Name="btnReschedule1" Content="Reschedule" HorizontalAlignment="Right" Command="{Binding GetInstallDates}" CommandParameter="1"
Visibility="{Binding CustomerModel.AccountInfo.ScheduleInfo, ConverterParameter=1, Converter={StaticResource ToVisibility}}" />
<Button Width="70" x:Name="btnReschedule0" Content="Reschedule" HorizontalAlignment="Right" Command="{Binding GetInstallDates}" CommandParameter="0"
Visibility="{Binding CustomerModel.AccountInfo.ScheduleInfo, ConverterParameter=0, Converter={StaticResource ToVisibility}}" />
</StackPanel>
<StackPanel Grid.Column="0" VerticalAlignment="Bottom">
<Label Margin="0,5,0,5" Content="{Binding CustomerModel.AccountInfo.WorkorderInfo.DisconnectDate, Converter={StaticResource WorkOrderMsg}}"
HorizontalAlignment="Left" FontWeight="Bold" Foreground="Blue" Visibility="{Binding CustomerModel.AccountInfo.WorkorderInfo.DisconnectDate, ConverterParameter=0, Converter={StaticResource WOMsgVisibility}}" VerticalAlignment="Center"/>
<Label Margin="0,5,0,5" Content="{Binding CustomerModel.AccountInfo.ScheduleInfo[1], Converter={StaticResource ValueConverter}}"
HorizontalAlignment="Left" FontWeight="Bold" Foreground="Blue" Visibility="{Binding Visibility, ElementName=btnReschedule1}" VerticalAlignment="Center"/>
<Label Margin="0,5,0,5" Content="{Binding CustomerModel.AccountInfo.ScheduleInfo[0], Converter={StaticResource ValueConverter}}"
HorizontalAlignment="Left" FontWeight="Bold" Foreground="Blue" Visibility="{Binding Visibility, ElementName=btnReschedule0}" VerticalAlignment="Center"/>
</StackPanel>
</Grid>
</StackPanel>
<StackPanel x:Name="NetworkQualification" Grid.Row="1" Margin="4,0,0,0" VerticalAlignment="Bottom" DockPanel.Dock="Bottom">
<TextBlock x:Name="txtbNetQualStatus" Text="{Binding CustomerModel.ServiceAddress.NetQualResult}" Foreground="Blue" FontWeight="Bold" />
<TextBlock x:Name="txtDupAddress" Text="{Binding CustomerModel.ServiceAddress.NoAddressFound}" Foreground="Blue" FontWeight="Bold"/>
</StackPanel>
<ListView Grid.Row="0" Name="lstSideCart" ScrollViewer.HorizontalScrollBarVisibility="Auto" DockPanel.Dock="Top"
ScrollViewer.VerticalScrollBarVisibility="Auto" ItemsSource="{Binding CustomerModel.AccountInfo.Services}" SelectionMode="Extended"
SelectionChanged="lstSideCart_SelectionChanged" MaxHeight="781" VerticalContentAlignment="Stretch" >
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="Foreground" Value="{Binding Path=ForegroundColor}"/>
<Setter Property="FontWeight" Value="{Binding Path=FontWeight}"/>
<Setter Property="BorderBrush">
<Setter.Value>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1" >
<GradientStop Color="DarkGray" Offset="0.0" />
<GradientStop Color="DarkGray" Offset="1.0" />
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Setter Property="BorderThickness" Value="0,0,0,0.5"/>
</Style>
</ListView.ItemContainerStyle>
<ListView.ContextMenu>
<ContextMenu ItemsSource="{Binding ContextMenuList}">
<ContextMenu.ItemTemplate>
<DataTemplate>
<MenuItem Header="{Binding Path=Header}" CommandParameter="{Binding}"
Click="MenuItem_Click" Visibility="{Binding Path=IsVisible}" Height="16"/>
</DataTemplate>
</ContextMenu.ItemTemplate>
</ContextMenu>
</ListView.ContextMenu>
<ListView.View>
<GridView>
<GridViewColumn Width="175" Header="Service Code Name" DisplayMemberBinding="{Binding Description}" />
<GridViewColumn Width="100" Header="Service Type" DisplayMemberBinding="{Binding ServiceCode.SecondaryServiceTypeSingle.ServiceTypeName}"/>
<GridViewColumn Width="25" Header="#" DisplayMemberBinding="{Binding CurrentQuantity}"/>
<GridViewColumn Width="68" Header="Added" DisplayMemberBinding="{Binding Path=DateAdded, StringFormat={}{0:MM/dd/yy}}"/>
</GridView>
</ListView.View>
</ListView>
</DockPanel>
</DockPanel>