开发者

Master-detail questions

I'm just learning开发者_JS百科 WPF/binding and Entity Framework. Currently I'm working on following:

  • There is master - detail - detail. I have commission plan, I have commission plan items and each commission plan item has eligible users.

On UI - commission plan object set as a context and I bind all properties. Main detail grid bind to CommissionPlanItems. That works great.

Couple problems I'm trying to solve. Or I guess I'm just looking for general guidence.

1. My CommissionPLanItems have LineNumber property. I don't really need it displayed but I need it populated and I need grid to display items in proper order. I placed button to move row up as a template:

<pre>
<code>
    <DataGridTemplateColumn>
        <DataGridTemplateColumn.CellTemplate>
            <DataTemplate>
                <Button Click="Button_Click">Move Up</Button>
            </DataTemplate>
        </DataGridTemplateColumn.CellTemplate>
    </DataGridTemplateColumn>
</code>
</pre>

I can handle that button click and get corresponding object but I have few problems a. Button displays in new grid row placeholder. How do I prevent it from displaying there? b. Is there way to automatically "reorder rows?

2. Each commission plan item can have multiple customers associated. How do I make this UI-wise? I was thinking some kind of button in a grid that will bring pop-up modal form where items can be selected.

3. Grid has drop down columns. When they go into "edit" mode - they make row taller. I don't really like that effect. How do I work around it?


For #1: yes it is possible to sort a gridview within WPF but not automatically. For that you may need to use a off-the shelf control from Telerik, Dundas, Infragistics etc. MSDN provides a nice tutorial on how to hook this up yourself via code. http://msdn.microsoft.com/en-us/library/ms745786.aspx

For #2: This depends on how you have your Type defined. You could do this via a tooltip on the cell with a custom datatemplate containing a listbox control applied which shows each person or their information. This could also be handled in a separate user control that could appear when the row is selected. You have a ton of options here. As long as you can get at the data you are golden. Just define what you need to show and anticipate the max number of records being displayed. Obvosuly if every row shows approximatley 10 records a small tooltip may not be the best approach but a larger floating usercontrol may be.

For #3: If you are using a datatemplate for the definition this object you could set MaxHeight or MaxWidth to control the maximum height of the control. This could also be affected by padding of the element so you may want to set the padding="0" (zero)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜