Devi Prasad
Devi Prasad

Reputation: 839

How to write different code for windows and windows phone apps in windows 10 apps

I created a new windows 10 app, In solution file common main page is created for windows and windows phone, now i want display button only in windows app, not in windows phone app, is it possible please help me..

<Grid x:Name="menu">
  <Button x:name="btn1" content="click"/>
</Grid>

I want to display this button only in window , not for Phone app, how to disable in windows phone..

Upvotes: 4

Views: 90

Answers (1)

Jerin
Jerin

Reputation: 4249

There are many ways in which you can do this.
1) Using device-family either in code behind or as another xaml
See this tutorial you will get the idea.
2) Now if you want you can also use Viewstates along with Adaptive triggers which is simple but these will work even when desktop app is resized to avoid that you will have to create device specific triggers. check out WindowsStateTriggers

Upvotes: 2

Related Questions