Boommer
Boommer

Reputation: 103

Why are my Adaptive Trigger not working

When I first run the code it work fine After a several debug and it just can't active the triggerenter image description here

I dont know why

But in the design screen it show up the layout I wanted

enter image description here

Here is the XAML code

        <VisualStateManager.VisualStateGroups>
        <VisualStateGroup x:Name="AdaptiveLayout">
            <VisualState x:Name="PhoneDisplay">
                <VisualState.StateTriggers>
                    <AdaptiveTrigger MinWindowWidth="0"/>
                </VisualState.StateTriggers>
                <VisualState.Setters>
                    <Setter Target="RelativePanelTop.Visibility" Value="Collapsed"/>
                    <Setter Target="RadialProgressBarControl1.Visibility" Value="Collapsed"/>
                    <Setter Target="StackMember.Visibility" Value="Collapsed"/>
                    <Setter Target="UploadSpeedText.Visibility" Value="Collapsed"/>
                    <Setter Target="ToolsGrid.Width" Value="*"/>
                    <Setter Target="RightPB.HorizontalAlignment" Value="Center"/>
                </VisualState.Setters>
            </VisualState>
            <VisualState x:Name="TabletDisplay">
                <VisualState.StateTriggers>
                    <AdaptiveTrigger MinWindowWidth="1500"/>
                </VisualState.StateTriggers>
                <VisualState.Setters>
                    <Setter Target="RelativePanelTop.Visibility" Value="Visibile"/>
                    <Setter Target="RadialProgressBarControl1.Visibility" Value="Visibile"/>
                </VisualState.Setters>
            </VisualState>
        </VisualStateGroup>
    </VisualStateManager.VisualStateGroups>

Upvotes: 1

Views: 495

Answers (2)

Boommer
Boommer

Reputation: 103

Found it ! This property mess all of them up, I dont why but when I delete it everything work

<Setter Target="ToolsGrid.Width" Value="*"/>

Upvotes: 0

Martin Zikmund
Martin Zikmund

Reputation: 39072

When Adaptive Triggers don't work, the first thing I check is if I haven't made a spelling error in the names of the controls somewhere. The easiest thing to do is to comment out all setters and then uncomment them one by one to see if they work gradually. The problem is that when any setter's Target or Value is misspelled, the whole trigger will seize to work completely, although it will not throw any exception.

My guess is that the problem will be with

<Setter Target="RelativePanelTop.Visibility" Value="Visibile"/>
<Setter Target="RadialProgressBarControl1.Visibility" Value="Visibile"/>

It seems you accidentally spelled "Visibile" instead of "Visible".

Upvotes: 3

Related Questions