Sunday 15 January 2012

datagrid - wpf DataGridTextColumn refactoring -


I use a Dokgreed'm in a WPF app which a) column for each day of stay (only weeks A sample of XAML is below in its data index, which is only different.

Can I refactor in something more dry?

Cheers, Berryl

Sample XAML (Seven columns from either):

  & lt; DG: DataGridTextColumn header = "{Binding Source = {StaticResource detective} path = DataContext [0] .EventDate, Converter = {StaticResource DateConv}}" CellStyle = '{StaticResource DataEntryCellStyle} "width =" 60 "CanUserResize =" false " Binding = "{binding allocation [0] .mount, converter = {StaticResource amtConv}}" /> & Lt; DG: DataGridTextColumn header = "{Source = {StaticResource detective} path = DataContext [1] .EventDate, Converter = {StaticResource dateConv} Binding}" CellStyle = '{StaticResource DataEntryCellStyle} "width =" 60 "CanUserResize =" false " binding = "{binding allocation [1]. The amount, Converter = {static resource Amticonw}}" />  

edit == add'l info @ JALFP ===

The compiler complains that the goal type is not a framework element when creating

   & Lt; Setter Property = "CanUserSort" value = "wrong" /> & Lt; Setter property = "width" value = "60" /> & Lt; Setter property = "cell style" value = "{static resource data intergridcloth style}" /> & Lt; / Style & gt;  

I do not see anything that looks like a column style What property would I set this style to DataGridTextColumn in XAML?

Maybe you can create your own class that inherits from DataGridTextColumn and Add a new dependency Property Day Index (up to 0 to 6). And in this category, you can initialize are Aksamel ...

But I'm not sure that it will actually be better and more suitable solutions ...


No comments:

Post a Comment