none
How can I make a custom control just like sheet of Excel?

    Question

  • I wanna make a custom control of sheet just like the Excel.

    Here are the features I need of the control:
    1. It can resize the width&height any time by the users like Excel.
    2. It can merge cell just like Excel.
    3. It can edit the content any time the users want just like Excel also.
    4. It has not a header.

    Totally, just like this: enter image description here

    In my first opinion, I think rewrite a DataGrid may be a good choice.

    However, I found that I can hardly rewrite all the style of it and I have no idea how to make the features of merging cell.

    Furthermore, it seems has not a free third-party control for this.

    I don't need the whole code about this. But I wanna know how to do it, at least a general idea.

    Would you please help me? Thank you.

    Thursday, May 16, 2019 1:03 AM

All replies

  • I wanna make a custom control of sheet just like the Excel.

    Here are the features I need of the control:
    1. It can resize the width&height any time by the users like Excel.
    2. It can merge cell just like Excel.
    3. It can edit the content any time the users want just like Excel also.
    4. It has not a header.


    Hi mywatermelon,

    According to your description, you want to create custom control like excel, you want to rewrite DataGrid to do this, I think it is the good idea, but this is also also cumbersome.

    So I suggest you can consider to use third-party control, for example: RadSpreadsheet from Telerik. You can search from internet, and try to use it in your project.

    Since you are developing with third-party API. We are unable to offer helpful suggestions.

    Since this forum is discussing and asking questions about the Visual Basic programming language, IDE, libraries, samples, and tool, and your issue is more related to C#, I will move this thread to the more related forum.

    Thanks for your understanding and support.

     

    Best Regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, May 16, 2019 2:46 AM
    Moderator
  • I wanna make a custom control of sheet just like the Excel.

    Here are the features I need of the control:
    1. It can resize the width&height any time by the users like Excel.
    2. It can merge cell just like Excel.
    3. It can edit the content any time the users want just like Excel also.
    4. It has not a header.


    Hi mywatermelon,

    According to your description, you want to create custom control like excel, you want to rewrite DataGrid to do this, I think it is the good idea, but this is also also cumbersome.

    So I suggest you can consider to use third-party control, for example: RadSpreadsheet from Telerik. You can search from internet, and try to use it in your project.

    Since you are developing with third-party API. We are unable to offer helpful suggestions.

    Since this forum is discussing and asking questions about the Visual Basic programming language, IDE, libraries, samples, and tool, and your issue is more related to C#, I will move this thread to the more related forum.

    Thanks for your understanding and support.

     

    Best Regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    It sounds is a huge work, right?

    The Telerik is not free so that I have to make one by myself. If there is no any other can do this, I think maybe I can only try to write a brand new one by Grid control only.

    Thursday, May 16, 2019 3:30 AM
  • It would be a lot of work to build such a control.

    Since you want something like Excel then why not use excel?

    Or open office.

    Do you realise just how complicated the datagrid is?

    https://referencesource.microsoft.com/#PresentationFramework/src/Framework/System/windows/Controls/DataGrid.cs

    https://docs.microsoft.com/en-us/dotnet/framework/wpf/controls/datagrid-styles-and-templates


    Hope that helps.

    Technet articles: WPF: Layout Lab; All my Technet Articles

    Saturday, May 18, 2019 2:34 PM
    Moderator
  • It would be a lot of work to build such a control.

    Since you want something like Excel then why not use excel?

    Or open office.

    Do you realise just how complicated the datagrid is?

    https://referencesource.microsoft.com/#PresentationFramework/src/Framework/System/windows/Controls/DataGrid.cs

    https://docs.microsoft.com/en-us/dotnet/framework/wpf/controls/datagrid-styles-and-templates


    Hope that helps.

    Technet articles: WPF: Layout Lab; All my Technet Articles

    I do not use the EXCEL for these reason:

    1. I don't need all the features of EXCEL. I just some base features such as I said above in the question.

    2. The sheet will convert into a image and thresholding it. So I need to control the style of sheet, that means I can only write a brand new control which style I want.

    Fortunately, by these days hard work I have made one base on Grid. Although it still has some small problem but it seems works well.

    Monday, May 20, 2019 6:36 AM
  • Hi mywatermelon,

    As Andy said, if you want to rewrite DataGrid like Excel, this is very troublesome, if you still want to do this, about merging cell like Excel, I suggest you can take a lookthe following thread:

    https://social.msdn.microsoft.com/Forums/en-US/e16e673c-d731-467a-ad59-a2eee69da8e0/how-to-merge-datagrid-cells-in-wpf?forum=wpf

    It do this by DataGrid row and column style.

    Best Ragards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, May 22, 2019 9:26 AM
    Moderator
  • Hi mywatermelon,

    As Andy said, if you want to rewrite DataGrid like Excel, this is very troublesome, if you still want to do this, about merging cell like Excel, I suggest you can take a lookthe following thread:

    https://social.msdn.microsoft.com/Forums/en-US/e16e673c-d731-467a-ad59-a2eee69da8e0/how-to-merge-datagrid-cells-in-wpf?forum=wpf

    It do this by DataGrid row and column style.

    Best Ragards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    I finished the work by using a Grid.

    Whereas, I don't know if the performance will lower than the DataGrid. Aha.

    Thursday, May 23, 2019 7:45 AM
  • Hi mywatermelon,

    Wow! It's cool! If you are free, please share your solution here, and mark as this solution as answer, it is beneficial to other community members who face the same issue.

    Thanks for your understanding.

    Best Regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, June 5, 2019 9:36 AM
    Moderator
  • Hi mywatermelon,

    Wow! It's cool! If you are free, please share your solution here, and mark as this solution as answer, it is beneficial to other community members who face the same issue.

    Thanks for your understanding.

    Best Regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Now there are still several small bugs and I need to fix it before publish. Aha.
    Friday, June 7, 2019 3:36 PM
  • Hi mywatermelon,

    Ok, I am waiting for your good news.

    Best Regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, June 14, 2019 7:00 AM
    Moderator