locked
Create custom window control with dynamic content RRS feed

  • Question

  • Hey community,

    I am quite new to the WPF and currently try to create a custom window control for an entity editor. The editor will hold a domainobject (e.g. an employee of a company) whose fields can be editted using the editor visually (name, surname, corporate id, etc...), and then be saved back to the database using generic "Save" and "Apply" buttons.

    Since I want the editor to be reusable for different entities, I intended to have the common buttons for saving and so on at the bottom of the window, and the rest be filled dynamically with editor-specific controls (textboxes, labels...).

    In the end, it should be used something like this using XAML:

    <EditorWindow x:Class="Redheads.PmisSharp.Client.Ui.Wnd.Editor.EditorBaseWindow"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
           mc:Ignorable="d" 
           d:DesignHeight="300" d:DesignWidth="300">
      <Grid>
    		<!-- The actual individual controls for this editor -->
      </Grid>
    </EditorWindow>

    In this example the mentioned "Save" / "Apply" buttons should be implicitly added at the bottom of the window. But I don't know how to achieve this at the moment. Can anyone give me a clue or point me to some links that can help me out? I think that ControlTemplates might do the trick, but I am not so sure about that.

    Any advice is appreciated, thanks!

    - PuerNoctis

    Thursday, January 6, 2011 9:07 AM

Answers

  • Okay, I got to a solution myself by now. So that the issue can be considered as solved, here's what I did, maybe someone else runs into a problem like this:

    http://social.msdn.microsoft.com/forums/en/wpf/thread/4f0cd7e3-65fa-4d2a-b29f-492e4209641c/

    This worked like a charm for me :)

    Any other suggestions/impovements/comments are very welcome!

    - PuerNoctis

    • Marked as answer by PuerNoctis Thursday, January 6, 2011 1:51 PM
    Thursday, January 6, 2011 1:50 PM

All replies

  • Okay, I got to a solution myself by now. So that the issue can be considered as solved, here's what I did, maybe someone else runs into a problem like this:

    http://social.msdn.microsoft.com/forums/en/wpf/thread/4f0cd7e3-65fa-4d2a-b29f-492e4209641c/

    This worked like a charm for me :)

    Any other suggestions/impovements/comments are very welcome!

    - PuerNoctis

    • Marked as answer by PuerNoctis Thursday, January 6, 2011 1:51 PM
    Thursday, January 6, 2011 1:50 PM
  • Hi PuerNoctis,

    I am glad to hear that you have resolved your issue on our forum.

    Welcome back if you have any difficulty in future programming.

     

    Best regards,


    Sheldon _Xiao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, January 7, 2011 8:58 AM