c# - Multiple grids in one area -


I am currently creating a WPF application in Visual Studio 2010 using C # and XAMM.

I have a master grid in that master grid I have a group bar in which you can choose individual items. Depending on what you choose, the master grid can be completely different between them. What was I thinking, what is the best way to program the central part?

Right now, I have established it in such a way that everything in the middle is programmed in C #, and everything is programmed in XAML

C # I programmed: For each group bar item, there is a grid that goes with it (so that different content can be displayed on it). Each grid is a child of the master grid. Is it the best way to approach whether every grid view or hiding is necessary?

The best example of this is Outlook 2007, where you have your own group bar on the right hand. When you select individual items on the group bar (Mail, Calendar, Work), the right to the right of the group bar changes completely. The easiest way to do this in WPF is to define the data template for your "medium" classes.

Using the Outlook instance, you may have a Message Collection class that stores a list of messages, an eventclass class that stores a list of calendar events, and a taskcallion class that works Stores a list.

In your "medium" area you will be the only content presenter whose content will be set to a message collection, eventclub, or task collection. It will probably be done using bindings for a visual model property.

Here's how:

  & lt; Window ... & gt; & Lt; Grid & gt; & Lt ;! - Group Bar area - & gt; ... & lt ;! - "medium" area - & gt; & Lt; ContentPresenter Grid.Row = "1" Grid. Column = "1" content = "{binding selected collection}" /> & Lt; / Grid & gt; & Lt; / Window & gt;  

Now you create a datatomplate for each collection type, for example:

  & lt; DataTimePlatform Target Type = "{x: Type My: MessageCollection}" & gt; & Lt; Grid & gt; ... Install XAM to display mailbox content ... & lt; / Grid & gt; & Lt; / DataTemplate & gt; & Lt; DataTimePlatform target type = "{x: type my: event collection}" & gt; & Lt; Grid & gt; ... Put an XAM to display a calendar here ... & lt; / Grid & gt; & Lt; / DataTemplate & gt; & Lt; DataTimeplateTypeType = "{x: Type my: Work Collection}" & gt; & Lt; Grid & gt; ... Put an XAM to display a to-do list ... & lt; / Grid & gt; & Lt; / DataTemplate & gt;  

With this setup, you have to switch the internal grid, set your "Model Selected" into a different collection type in your visual model.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -