开发者

how can i use the same xaml file with two different code files?

i have some xaml that can be use twice

  1. will be show information from database table of product group 1
  2. will be show information from database table of product group 2

I don't want to write the same xaml - but i want to write a different .cs file that the xaml will be attached with => i mean that in the main window i will show the xaml first with the information config from file info1.cs ; and when the main window will load the xaml at the second time the infor开发者_开发技巧mation config will be from file info2.cs.

Is it possible to do it ?

( this is information question ... i know that i can do it with some switch case that will suck the information ( according to some flag ) from different table )


You could use two different ViewModels, which would seem to be the preferred way to do it.

Alternatively, if you really want to use this pattern, just use inheritance. Write two different implementations and have them each inherit from your XAML's code-behind.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜