私はユーザーコントロールを持っています:
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/UserInterface;component/Skins/MainSkin.xaml" />
</ResourceDictionary.MergedDictionaries>
<converters:WidgetWidthConverter x:Key="widgetWidthConverter" />
<converters:TileSizeConverter x:Key="tileSizeConverter" />
<converters:ListCountToVisibilityConverter x:Key="listCountToVisibilityConverter" />
<views:SubplantMainStaticControl x:Key="subplantMainStaticControl" />
<views:SubplantMainActualControl x:Key="subplantMainActualControl" />
</ResourceDictionary>
</UserControl.Resources>
<dxlc:TileLayoutControl Background="{x:Null}"
x:Name="tileControl"
Margin="10"
Padding="0"
ScrollBars="None"
LayoutUpdated="OnTileControlUpdated">
<dxlc:Tile Style="{StaticResource customizedTileStyle}"
Height="{Binding Source={StaticResource subplantMainStaticControl}, Path=ActualHeight, Converter={StaticResource tileSizeConverter}}"
Name="staticDataTile"
VerticalContentAlignment="Top">
<custom:Widget Name="staticDataWidget"
DataContext="{Binding Path=StaticViewModel}"
CanResize="False">
<custom:Widget.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Source={StaticResource DataViewResources}, Path=Resource.StaticDataText}"
Style="{StaticResource widgetHeaderTextBlock}" />
</StackPanel>
</custom:Widget.Header>
<StackPanel>
<ContentPresenter Content="{StaticResource subplantMainStaticControl}" />
</StackPanel>
</custom:Widget>
</dxlc:Tile>
<dxlc:Tile Style="{StaticResource customizedTileStyle}"
Height="{Binding Source={StaticResource subplantMainActualControl}, Path=ActualHeight, Converter={StaticResource tileSizeConverter}}"
Name="actualDataTile"
VerticalContentAlignment="Top">
<custom:Widget Name="actualDataWidget"
DataContext="{Binding Path=ActualViewModel}"
CanResize="False">
<custom:Widget.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Source={StaticResource DataViewResources}, Path=Resource.LatestDataText}"
Style="{StaticResource widgetHeaderTextBlock}" />
</StackPanel>
</custom:Widget.Header>
<StackPanel>
<ContentPresenter Content="{StaticResource subplantMainActualControl}" />
</StackPanel>
</custom:Widget>
</dxlc:Tile>
</dxlc:TileLayoutControl>
views:SubplantMainActualControl は次のとおりです。
<UserControl x:Class="UserInterface.Views.SubplantMainActualControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
dx:ThemeManager.ThemeName="Seven"
xmlns:views="clr-namespace:UserInterface.Views">
<views:LayoutLabelValueControl Grid.Row="0"
ItemsSource="{Binding Path=ActualRepresentations}" />
</UserControl>
ウィジェットは次のとおりです。
<dxlc:GroupBox x:Class="CustomControls.Widget"
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:dxlc="http://schemas.devexpress.com/winfx/2008/xaml/layoutcontrol"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:custom="clr-namespace:CustomControls"
xmlns:converters="clr-namespace:CustomControls.Converters"
xmlns:constants="clr-namespace:Business.Constants;assembly=Business"
mc:Ignorable="d"
x:Name="baseTile"
dx:ThemeManager.ThemeName="Seven"
Margin="0,2,0,2"
IsManipulationEnabled="True"
Foreground="Black"
Padding="1"
Background="Transparent"
MinimizeElementVisibility="Visible"
Style="{DynamicResource GroupBoxStyle1}"
VisualTextHintingMode="Animated"
PreviewMouseLeftButtonDown="OnPreviewMouseLeftButtonDown">
<dxlc:GroupBox.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/CustomControls;component/Themes/MainSkin.xaml" />
</ResourceDictionary.MergedDictionaries>
<converters:BoolToVisibilityConverter x:Key="boolToVisibilityConverter" />
<Style x:Key="GroupBoxStyle1"
TargetType="{x:Type dxlc:GroupBox}">
<Setter Property="Background"
Value="Transparent" />
<Style.BasedOn>
<Style TargetType="{x:Type dxlc:GroupBox}">
<Setter Property="CornerRadius"
Value="3" />
<Setter Property="MinimizationDirection"
Value="Vertical" />
<Setter Property="Padding"
Value="11" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type dxlc:GroupBox}">
<dx:Container x:Name="container">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="LayoutStates">
<VisualState x:Name="NormalLayout" />
<VisualState x:Name="MinimizedLayout">
<Storyboard>
<ObjectAnimationUsingKeyFrames Duration="0"
Storyboard.TargetProperty="Visibility"
Storyboard.TargetName="TitleStretcher">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Duration="300"
Storyboard.TargetProperty="Visibility"
Storyboard.TargetName="SeparatorElement">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Duration="0"
Storyboard.TargetProperty="Visibility"
Storyboard.TargetName="contentPresenter">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="MaximizedLayout" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<ContentControl x:Name="widgetContet"
Template="{DynamicResource DesignerItemTemplate}">
<Border x:Name="BorderElement"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
dx:BorderExtensions.ClipChild="True"
CornerRadius="{TemplateBinding CornerRadius}"
Style="{DynamicResource contentBorderStyle}">
<Grid x:Name="layoutGrid">
<dxlc:LayoutControl ItemSpace="0"
Orientation="Vertical"
Padding="0"
ScrollBars="None">
<dxlc:LayoutGroup x:Name="groupBoxHeaderLayoutGroup"
Background="{TemplateBinding TitleBackground}"
ItemSpace="0"
Padding="2"
Visibility="{TemplateBinding TitleVisibility}">
<Rectangle x:Name="TitleStretcher"
Visibility="Collapsed"
Width="0" />
<dx:DXContentPresenter ContentTemplate="{TemplateBinding HeaderTemplate}"
Content="{TemplateBinding Header}"
IsTabStop="False"
Margin="9,0"
VerticalAlignment="Center">
<dx:DXContentPresenter.Template>
<ControlTemplate TargetType="{x:Type dx:DXContentPresenter}">
<ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}"
Content="{TemplateBinding Content}" />
</ControlTemplate>
</dx:DXContentPresenter.Template>
</dx:DXContentPresenter>
<Button x:Name="ColumnsElement"
HorizontalAlignment="Right"
Margin="2"
VerticalAlignment="Center"
Content="{Binding Source={StaticResource DataViewResources}, Path=Resource.ColumnsText}"
Command="{Binding Path=ColumnsCommand, ElementName=baseTile, Mode=OneWay}"
Visibility="{Binding Path=ColumnsButtonVisibility, ElementName=baseTile, Mode=OneWay}"
Style="{DynamicResource HeaderButtonStyle}" />
<Button x:Name="SettingsElement"
HorizontalAlignment="Right"
Margin="2,0,0,0"
VerticalAlignment="Center"
Content="{Binding Source={StaticResource DataViewResources}, Path=Resource.SettingsText}"
Visibility="Collapsed"
Style="{DynamicResource SettingsButtonStyle}" >
<Button.ContextMenu>
<ContextMenu HasDropShadow="True">
<ContextMenu.Items>
<!--<MenuItem Header="Setting 1"
Command="{Binding Path=SettingsCommand, ElementName=baseTile, Mode=TwoWay}" />
<MenuItem Header="Setting 2"
Command="{Binding Path=SettingsCommand, ElementName=baseTile, Mode=TwoWay}" />-->
</ContextMenu.Items>
</ContextMenu>
</Button.ContextMenu>
</Button>
<dxlc:GroupBoxButton x:Name="MinimizeElement"
HorizontalAlignment="Right"
Kind="Maximize"
Margin="2,0,0,0"
Visibility="{TemplateBinding MinimizeElementVisibility}"
VerticalAlignment="Center">
</dxlc:GroupBoxButton>
<dxlc:GroupBoxButton x:Name="MaximizeElement"
HorizontalAlignment="Right"
Kind="Minimize"
Margin="2,0,0,0"
Visibility="{TemplateBinding MaximizeElementVisibility}"
VerticalAlignment="Center">
</dxlc:GroupBoxButton>
</dxlc:LayoutGroup>
<Rectangle x:Name="SeparatorElement"
Fill="{TemplateBinding SeparatorBrush}"
Height="1"
Visibility="{TemplateBinding TitleVisibility}" />
<!--HorizontalScrollBarVisibility="Auto"-->
<dx:DXContentPresenter x:Name="contentPresenter"
ContentTemplate="{TemplateBinding CurrentContentTemplate}"
Content="{TemplateBinding Content}"
IsTabStop="False"
Margin="{TemplateBinding Padding}"
MaxHeight="{TemplateBinding MaxHeight}"
MinHeight="{TemplateBinding MinHeight}">
<dx:DXContentPresenter.Template>
<ControlTemplate TargetType="{x:Type dx:DXContentPresenter}">
<ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}"
Content="{TemplateBinding Content}"/>
</ControlTemplate>
</dx:DXContentPresenter.Template>
</dx:DXContentPresenter>
</dxlc:LayoutControl>
<custom:BusySpinner Visibility="{Binding Path=DataLoading, Converter={StaticResource boolToVisibilityConverter}}"
Style="{StaticResource busySpinnerStyle}" />
</Grid>
</Border>
</ContentControl>
<Control Template="{DynamicResource ResizeDecoratorTemplate}"
DataContext="{Binding ElementName=baseTile}" />
</dx:Container>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Style.BasedOn>
</Style>
<!-- Designer Item Template-->
<ControlTemplate x:Key="DesignerItemTemplate"
TargetType="ContentControl">
<Grid x:Name="contextGrid"
DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}">
<ContentPresenter Content="{TemplateBinding ContentControl.Content}" />
</Grid>
</ControlTemplate>
<!-- ResizeDecorator Template -->
<ControlTemplate x:Key="ResizeDecoratorTemplate"
TargetType="{x:Type Control}">
<Grid>
<custom:ResizeThumb x:Name="resizeThumbBottom"
Height="1"
Cursor="SizeNS"
Margin="3 0 3 -1"
VerticalAlignment="Bottom"
HorizontalAlignment="Stretch"
Visibility="{Binding Path=CanResize, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource boolToVisibilityConverter}}">
</custom:ResizeThumb>
</Grid>
</ControlTemplate>
</ResourceDictionary>
</dxlc:GroupBox.Resources>
</dxlc:GroupBox>
現在、ウィジェットの高さが 0 であるかのように、ウィジェットのヘッダー (別名グループ ボックス) のみを含む「actualDataTile」と呼ばれるタイルが表示されることがあります。コントロールをリロードすると、タイルのコンテンツが正しく表示されます。
私を正しい方向に導くことができる何かを教えてもらえますか?