私は比較的 wpf/mvvm に慣れていないので、これはおそらく基本的なものですが、それ自体で完全に表示されるユーザー コントロールがありますが、それを別のユーザー コントロールのスタックパネルに読み込もうとすると、表示されません。まったく。ここで私が間違っていることを誰かが知っていますか? 幅/高さ/最小幅/最小高さを設定しようとしましたが、どれも違いはありません。
再利用可能なユーザー コントロールの xaml は次のとおりです。
<UserControl x:Class="BankProductControlLibrary.Views.IdentificationData"
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:bpcl="clr-namespace:BankProductControlLibrary.UserControls"
mc:Ignorable="d"
d:DesignHeight="102" d:DesignWidth="535">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BankProductSilverlightControl;component/Resources/Style.xaml"/>
<ResourceDictionary>
<Style x:Key="textBlockStyle" TargetType="TextBlock">
<Setter Property="Height" Value="28"/>
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="Width" Value="409" />
</Style>
<Style x:Key="textBlockStyle2" TargetType="TextBlock">
<Setter Property="Height" Value="23"/>
<Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="Width" Value="Auto" />
<Setter Property="Margin" Value="0,0,0,0" />
</Style>
<Style x:Key="comboBoxStyle" TargetType="ComboBox">
<Setter Property="Height" Value="23"/>
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="Width" Value="180" />
<Setter Property="Margin" Value="0,0,0,0" />
</Style>
<Style x:Key="textBoxStyle" TargetType="TextBox">
<Setter Property="Height" Value="23"/>
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="Margin" Value="0,0,0,0" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="Width" Value="132" />
</Style>
<Style x:Key="dateBoxStyle" TargetType="bpcl:DateBox">
<Setter Property="Height" Value="23"/>
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="Margin" Value="0,0,0,0" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="Width" Value="75" />
</Style>
<Style x:Key="dateFormatingExplanationStyle" TargetType="TextBlock">
<Setter Property="FontSize" Value="9"/>
<Setter Property="FontStyle" Value="Italic" />
<Setter Property="Height" Value="23" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Width" Value="75"/>
<Setter Property="Text" Value="(mm/dd/yyyy)" />
</Style>
<Style x:Key="placeOfIssuanceExplanationStyle" TargetType="TextBlock">
<Setter Property="FontSize" Value="9"/>
<Setter Property="FontStyle" Value="Normal" />
<Setter Property="Height" Value="23" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Width" Value="Auto"/>
</Style>
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<StackPanel MinHeight="102" MinWidth="535">
<TextBlock Style="{StaticResource textBlockStyle}">
Select the ID provided from the drop-down list. ID must be a photo ID.
</TextBlock>
<Grid Style="{StaticResource ScreenStyle}" x:Name="LayoutRoot" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="110*" />
<ColumnDefinition Width="180" />
<ColumnDefinition Width="88*" />
<ColumnDefinition Width="142*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<!--Column0-->
<TextBlock Style="{StaticResource textBlockStyle2}"
Grid.Row="0" Grid.Column="0"
Text="Type:"
/>
<TextBlock Style="{StaticResource textBlockStyle2}"
Grid.Row="1" Grid.Column="0"
Text="Date of Issuance:"
/>
<TextBlock Style="{StaticResource textBlockStyle2}"
Grid.Row="2" Grid.Column="0"
Text="Place of Issuance:" />
<!--Column1-->
<ComboBox Name="Ids" Style="{StaticResource comboBoxStyle}"
Grid.Row="0" Grid.Column="1"
DisplayMemberPath="Value"
SelectedValuePath="Key"
SelectedValue="{Binding SelectedTaxpayerId, Mode=TwoWay}"
/>
<StackPanel Orientation="Horizontal"
Grid.Row="1" Grid.Column="1">
<bpcl:DateBox x:Name="IssueDate" Style="{StaticResource dateBoxStyle}"/>
<TextBlock Style="{StaticResource dateFormatingExplanationStyle}" />
</StackPanel>
<StackPanel Orientation="Horizontal"
Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2">
<!--This should be bpcl:AlphaTextBox-->
<TextBox Name="PlaceOfIssuance" Style="{StaticResource textBoxStyle}"
MaxLength="2"
Width="40"/>
<TextBlock Style="{StaticResource placeOfIssuanceExplanationStyle}"
Text="Enter state abbreviation or country code"
/>
</StackPanel>
<!--Column2-->
<TextBlock Style="{StaticResource textBlockStyle2}"
Grid.Row="0" Grid.Column="2"
Text="ID Number:"
/>
<TextBlock Style="{StaticResource textBlockStyle2}"
Grid.Row="1" Grid.Column="2"
Text="Expiration Date:"/>
<!--Column3-->
<TextBox Name="IdentificationNumber" Style="{StaticResource textBoxStyle}"
Grid.Row="0" Grid.Column="3" />
<StackPanel Orientation="Horizontal"
Grid.Row="1" Grid.Column="3" >
<bpcl:DateBox x:Name="ExpirationDate" Style="{StaticResource dateBoxStyle}"/>
<TextBlock Style="{StaticResource dateFormatingExplanationStyle}" />
</StackPanel>
</Grid>
</StackPanel>
</UserControl>
そして、ここで私はそれを消費しようとしています:
<UserControl x:Class="BankProductControlLibrary.Views.JTH.TaxpayerIdentificationView"
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:ltsa="http://www.libtax.com/LibTax/BankApp"
xmlns:bpcl="clr-namespace:BankProductControlLibrary.UserControls"
xmlns:views="clr-namespace:BankProductControlLibrary.Views"
mc:Ignorable="d ltsa"
d:DesignHeight="102" d:DesignWidth="520">
<UserControl.Resources>
<Style x:Key="validationStyle" TargetType="TextBlock">
<Setter Property="Height" Value="23" />
<Setter Property="Width" Value="Auto"/>
<Setter Property="Foreground" Value="Red" />
</Style>
</UserControl.Resources>
<StackPanel>
<views:IdentificationData x:Name="TPIdentification" />
<TextBlock Name="ValidationErrorMessage" Style="{StaticResource validationStyle}" />
</StackPanel>
</UserControl>