jaiell

hey i'm very new to the wpf environment but i've been doing some work with blend

right now i'm trying to make an app window which would re-align its parts if it were resized to a certain point. can anyone tell me if there is a trigger that could work with this

i seem to remember seeing a default trigger like "when width = 0" or something like that, but i can't seem to find it now. any suggestions would be appreciated -j


Re: Windows Presentation Foundation (WPF) How to set a blend trigger on resizing?

WPCoder

Although you could create a style, which had a property trigger like you want:

Code Snippet

<Style x:Key="WindowStyle1" TargetType="{x:Type Window}">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Window}">
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
<AdornerDecorator>
<ContentPresenter/>
</AdornerDecorator>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="Width" Value="500"/>
<Trigger Property="ResizeMode" Value="CanResizeWithGrip">
<Setter Property="Template" Value="{StaticResource WindowTemplateKey}"/>
</Trigger>
</Style.Triggers>
</Style>

The problem is -- there's no easy way to do it when it reaches a 'range'. What I want (and others) is for the Property to be triggerable based on a range of values:

Between="0;500" for example. But, that doesn't exist. The most reliable way and easiest, would be to add code to handle the resize and trigger the code/event you want to happen when that size is reached. If it's an absolute size you want, then the example above would work.