hi,
we had previously written a wrapper around the ultragrid that reflected on the attributes of the list of ITypedItem that it was bound to to format the column / hide it / set it as read only etc.
(this allowed us to easily set the format of the column by specifying an attribute on the appropriate property)
I would like to do a similar layer if possible for the xamdatagrid.
Any tips on how i could go about this?
in the ultragridcolumn we used to be able to call GetPropertyDescriptor and then go throught the attributes of that.
i see field has the GetPropertyDescripto but this required a Data Record?
any ideas if it's possible to do something similar with the xam grid
also it seems that some attributes are picked up currently (Browsable()) and DisplayName())
is there a listof currently used attributes and their functions?
Hello,
I believe there is no official documentation for which attributes are natively supported with the XamDataGrid. To the ones that you have already discover, I can add the ReadOnly attribute which will set the AllowEdit property of the field. In case you have other attributes that are not implemented, you can submit feature requests for them here.
thanks Alex,
any word on being able to write a custom layer to pull up the attributes of my properties manually and format my xamgrid?
We used to create all kinds of custom descriptors for
column sort order
column format (for money, numerical formats etc.)
which was great as it was all reusable on our grids throughout the app...
these aren't standard attributes though.
the other thing was do the attributes do you support Dynamic Attributes in C#
i.e.something like http://geekswithblogs.net/abhijeetp/archive/2009/01/10/dynamic-attributes-in-c.aspx
this would be useful as we need to programatically set the readonly property based on values on the bound item.
I am not sure how your project is set up, but you can take a look at the attached solution of one way to do this.
I am attaching a sample project demonstrating the use of MultiValueConverters.
In your case, I would recommend using MultiDataTrigger instead of DataTrigger if you need to bind to multiple values.
I tried the following with no luck (the multivalue convertor is called but the values in the object[] are set to dependencyproperty value not set?
can anyone help with how to do the binding?
<
Style TargetType="{x:Type src:CellValuePresenter}">
Style.Triggers>
DataTrigger Value="False">
DataTrigger.Binding>
MultiBinding Converter="{StaticResource ReadOnlyConverter}">
Binding Path="Record.DataItem" />
Binding Path="Field.Name" />
</
MultiBinding>
</D
ataTrigger.Binding>
Hi Alex,
sorry, why does starting the trigger fron the cellvalue presenter cause this problem?
it seems to me that i should have access to the cellvaluepresenter's properties from my code? the record is resolving fine, but the field is null?
could you give me any sample code as to how i can pass in the column name as a parameter to my convertor as i'm a bit confused from these articles
For more information on value converters, please follow the following links :
WPF Converters
WPF Converters in XamDataGrid
ok, is there any guides on multi-value convertors or how to use the convert parameters. I need to pass in the dataitem and the column name to work out if the column is read-only or not.