Есть ли какие-либо известные причины, по которым элементы управления моего графического интерфейса меняются после перехода на целевую версию 17314 с 15063? - PullRequest
0 голосов
/ 12 февраля 2019

Мое приложение использует сводное меню.Элементы сводного меню содержат пользовательский элемент управления, который представляет собой страницу, поэтому вы нажимаете на элемент сводки, и он переносит вас на страницу сведений об этом сводном элементе, что-то вроде стиля мастер / подробности.

Я хочуобновить мою целевую версию до версии 17134, но когда я делаю это, я получаю странное поведение с элементами управления.Граница внутри оси в версии 15063 регулирует ее размер в зависимости от содержимого.В 17134 его размер не регулируется в зависимости от содержания.

Я попытался установить высоту = авто в scrollviewer, который является держателем предъявителя контента в сводной области.Я пробовал много разных вещей с высотами на разных элементах управления, но не повезло.Любая помощь очень ценится.

Это стержень

 <Control.Resources>
    <vmc:NullableIntToIntConverter  x:Key="NullableIntToIntConverter"/>
    <Style TargetType="PivotHeaderItem">
        <Setter Property="FontFamily" Value="Segoe UI" />
        <Setter Property="FontWeight" Value="{ThemeResource PivotHeaderItemThemeFontWeight}" />
        <Setter Property="FontSize" Value="20" />
        <Setter Property="CharacterSpacing" Value="{ThemeResource PivotHeaderItemCharacterSpacing}" />
        <Setter Property="Background" Value="#477DAC" />
        <!--6B84AA-->
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="Padding" Value="{ThemeResource PivotHeaderItemMargin}" />
        <Setter Property="Height" Value="35" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="PivotHeaderItem">
                    <Grid x:Name="Grid" Background="{TemplateBinding Background}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="SelectionStates">
                                <VisualStateGroup.Transitions>
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledBaseMediumLowBrush}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unselected" />
                                <VisualState x:Name="UnselectedLocked">
                                </VisualState>
                                <VisualState x:Name="Selected">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Background">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Transparent" />
                                        </ObjectAnimationUsingKeyFrames>

                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Black" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="FontWeight">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Bold" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Grid" Storyboard.TargetProperty="Background">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightTransparentBrush}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="UnselectedPointerOver">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltBaseMediumHighBrush}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="SelectedPointerOver">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltBaseMediumHighBrush}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Grid" Storyboard.TargetProperty="Background">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightTransparentBrush}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="FontWeight">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Bold" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="UnselectedPressed">
                                    <Storyboard>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="SelectedPressed">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltBaseMediumHighBrush}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Grid" Storyboard.TargetProperty="Background">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightTransparentBrush}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <ContentPresenter x:Name="ContentPresenter" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" Margin="{TemplateBinding Padding}" FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}" FontWeight="{TemplateBinding FontWeight}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                            <ContentPresenter.RenderTransform>
                                <TranslateTransform x:Name="ContentPresenterTranslateTransform" />
                            </ContentPresenter.RenderTransform>
                        </ContentPresenter>
                        <Border x:Name="TopLine" Height="2" Background="#D3D3D3" VerticalAlignment="Top" HorizontalAlignment="Stretch" />
                        <Border x:Name="BottomLine" Height="2" Background="#D3D3D3" VerticalAlignment="Bottom" HorizontalAlignment="Stretch" />
                        <Border x:Name="RightLine" Width="1" Background="#D3D3D3" VerticalAlignment="Stretch" HorizontalAlignment="Right" Height="{TemplateBinding Height}" />
                        <Border x:Name="LeftLine" Width="1"  Background="#D3D3D3" VerticalAlignment="Stretch" HorizontalAlignment="Left" Height="{TemplateBinding Height}" />
                        <Border x:Name="SelectedLine" Height="2" VerticalAlignment="Bottom" HorizontalAlignment="Stretch" Background="#D3D3D3" Margin="15,0,0,0" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
<StackPanel>
    <Border BorderBrush="#477DAC" BorderThickness="1,1,1,1"  Margin="0,0,0,0"   >
        <Pivot Name="pvtSecondLevel" SelectedIndex="{Binding SelectedIndex, Mode=TwoWay}"  Background="#FFFFFF" ManipulationMode="None" Padding="0" >
            <Pivot.HeaderTemplate>
                <DataTemplate x:DataType="models:MenuItem">
                    <TextBlock Text="{Binding HeaderTitle, Mode=OneWay}"/>
                </DataTemplate>
            </Pivot.HeaderTemplate>
            <Pivot.ItemTemplate  >
                <DataTemplate x:DataType="models:MenuItem" >
                    <ScrollViewer >
                        <ContentPresenter  Content="{Binding Content}"   />
                    </ScrollViewer>
                </DataTemplate>
            </Pivot.ItemTemplate>
        </Pivot>
    </Border>
</StackPanel>

Это общий шаблон страницы, все страницы которого следуют, которыеэто содержимое в сводной таблице

<local:BaseControl
    x:Class="LD75ClaimSystem.UI.View.IncomeDetailsView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="using:LD75ClaimSystem.UI.View"
    xmlns:grid="using:Telerik.UI.Xaml.Controls.Grid"
    xmlns:vm="using:LD75ClaimSystem.UI.ViewModel"
    mc:Ignorable="d"
    <StackPanel DataContext="{StaticResource VM}" >
        <Grid Margin="10,0,0,0">
            <Button Content="Add Income"  Margin="0,10,0,0" />
            <ComboBox Header="Claim" Grid.Column="2"/>
        </Grid>
        <grid:RadDataGrid Name="DetailsGrid">
            <grid:RadDataGrid.Columns>

            </grid:RadDataGrid.Columns>
        </grid:RadDataGrid>
    </StackPanel>
</local:BaseControl>

Это ожидаемое поведение и поведение с версией 15063. Если я уберу сетку, граница откорректирует свой размер, чтобы соответствовать содержимому.

expected expected

Это результат версии 17314. Граница больше не приспосабливается к размеру и, похоже, управляется магией, как и сама.

not expected not expected

ОБНОВЛЕНИЕ После загрузки SDK для 16299 неожиданное поведение исчезло.Целевая версия 17134 по-прежнему вызывает непредвиденное поведение.

https://imgur.com/a/ZZfa09I

1 Ответ

0 голосов
/ 12 марта 2019

Я не эксперт в RadDataGrid, но мне кажется, что я смотрю на этот вопрос / ответ на него (https://www.telerik.com/forums/raddatagrid-and-scroll-bar), он содержит свои ScrollViewer для данных. Это означает, что вы невам нужно ScrollViewer в DataTemplate. *1007*.

Во-вторых, ваш StackPanel внутри вашего BaseControl не будет сообщать содержащимся элементам управления, какова его высота ... потому что он будет продолжать расширятьсячтобы соответствовать содержанию. Таким образом, ваш RadDataGrid вообще не использует свой ScrollViewer в этом случае. Я ожидаю, что ваши странные проблемы с высотой / запасом будут связаны с тем, как разные версии ScrollViewer / StackPanel'и RadDataGrid договариваются об их соответствующих размерах.

Он может исчезнуть, если вы удалите ScrollViewer и замените StackPanel на Grid, содержащий два RowDefinitions ... один с Авто высотойа второй с * высота.

как то так:

<local:BaseControl
    x:Class="LD75ClaimSystem.UI.View.IncomeDetailsView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="using:LD75ClaimSystem.UI.View"
    xmlns:grid="using:Telerik.UI.Xaml.Controls.Grid"
    xmlns:vm="using:LD75ClaimSystem.UI.ViewModel"
    mc:Ignorable="d"
    <Grid DataContext="{StaticResource VM}" >
       <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Button Content="Add Income"  Margin="10,10,0,0" />
        <ComboBox Header="Claim" HorizontalAlignment="Right" Margin="0,10,10,0"/>
        <grid:RadDataGrid Name="DetailsGrid" Grid.Row="1">
            <grid:RadDataGrid.Columns>

            </grid:RadDataGrid.Columns>
        </grid:RadDataGrid>
    </StackPanel>
</local:BaseControl>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...