WPF - customize view using triggers in Windows Phone 8.1 -


I want to customize my view in Windows Phone 8.1 app (WPF). I used something like this in my desktop project:

  & lt; Grid & gt; & Lt; Grid.Style & gt; & Lt; Style & gt; & Lt; Style.Triggers & gt; & Lt; Data Trigger Binding = "{Binding IsTrueValue}" value = "False" & gt; & Lt; Setter property = "visibility" value = "hidden" /> & Lt; / DataTrigger & gt; & Lt; Data Trigger Binding = "{Binding IsTrueValue}" value = "true" & gt; & Lt; Setter property = "visibility" value = "view" /> & Lt; / DataTrigger & gt; & Lt; /Style.Triggers> & Lt; / Style & gt; & Lt; /Grid.Style> & Lt; / Grid & gt;   

Unfortunately Style.Triggers are not recognized.

Thanks for the help

Windows Phone does not use WPF or you So you can use the Windows Phone Silverlight or Windows Phone Runtime Code. XML is used in all three environments, but the exact classes available are different.

Although there is no direct support for triggers, defines a datagram trigger behavior that works similar to the Windows runtime application behavior is included in Blend's asset pane and its designer is visually impaired Can be installed.

  xmlns: interactive = "using: Microsoft.Xaml.Interactivity" xmlns: core = "using: Microsoft.Xaml.Interactions.Core" & lt; Grid & gt; & Lt; Interactivity: Interaction.Behaviors & gt; & Lt; Core: DataTrigor Beaver Binding = "{Binding IsTrueValue}" value = "true" & gt; & Lt; Core: ChangePropertyAction property name = "visibility" & gt; & Lt; Core: ChangePropertyAction.Value & gt; & Lt; Visibility & gt; Visible & lt; / Visibility & gt; & Lt; / Core: ChangePropertyAction.Value & gt; & Lt; / Core: ChangePropertyAction & gt; & Lt; / Core: DataTriggerBehavior & gt; & Lt; Core: Data Trigger Binding = "{Binding IsTrueValue}" value = "False" & gt; & Lt; Core: ChangePropertyAction property name = "visibility" & gt; & Lt; Core: ChangePropertyAction.Value & gt; & Lt; Visibility & gt; Shortened & lt; / Visibility & gt; & Lt; / Core: ChangePropertyAction.Value & gt; & Lt; / Core: ChangePropertyAction & gt; & Lt; / Core: DataTriggerBehavior & gt; & Lt; / Interactivity: Interaction.Behaviors & gt; & Lt; / Grid & gt;   

As Vlad suggests, you can use VisualStateManager instead of setting up Visual Studio property directly. You can use DataTriggerBehavior to trigger a GoToStateAction.

Also keep in mind that the Visibility.Hidden Windows Phone Runtime or Windows Phone Silverlight is not valid for either. Both allow visible and collapsed options.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -