Welcome to the Xceed Community | Help
Community Search  
More Search Options

Complex cell layout

Sort Posts: Previous Next
  •  01-20-2010, 5:33 AM Post no. 25479

    Complex cell layout

    Hello,

    I need to display the data in the format like amount@price (1.23@1 000 000) in the PRO grid. I have created a temple like the following

    <DataTemplate x:Key="RequestedOrder">
          <StackPanel Orientation="Horizontal">
            <TextBlock Text="{Binding RequestedAmount, Converter={StaticResource textFormatConverter}, ConverterParameter=QuantityFormatWithM}"/>
            <TextBlock Text="@"/>
            <TextBlock Text="{Binding RequestedPrice}"/>
          </StackPanel>
    </DataTemplate>

    Now, I want this to be applied to a cell in the grid. 

    <DataGrid:DataGridControl.Columns>
            <DataGrid:Column Title="Requested" CellContentTemplate="{StaticResource RequestedOrder}"/>

    </DataGrid:DataGridControl.Columns>

    Certainly, this column doesn't exist in the source list, thus I need to generate it in the runtime.

    The code stated above doesn't work as I get the following:"Resolution of the dependency failed, type = "TraderStation.OrderRouting.Views.Blotter.StrategyBlotterPresenter", name = "". Exception message is: The current build operation (build key Build Key[TraderStation.OrderRouting.Views.Blotter.StrategyBlotterPresenter, null]) failed: An attempt was made to normalize an item, which is not in the default list, without a DataType. (Strategy type BuildPlanStrategy, index 3)"

    Could you please clarify how can I add a summary column to a DataGrid without modifying the domain object? The same can be applied to adding a Edit/Delete type of buttons to every row in the grid.

    Thanks in advance!

     

  •  01-21-2010, 11:44 AM Post no. 25502 in reply to 25479

    Re: Complex cell layout

    Hi Kyrylo,

    Since the Requested field does not exist in the data source, you should implement an UnboundColumn instead of a Column. The Column class requires to be bound to a valid and existing field of the data source.

     

    For example:

     

    <DataGrid:DataGridControl.Columns>

    <DataGrid:UnboundColumn Title="Requested"               CellContentTemplate="{StaticResource RequestedOrder}"/>

    </DataGrid:DataGridControl.Columns>


    Xceed - Software Developer and Technical Support
  •  01-22-2010, 9:41 AM Post no. 25517 in reply to 25502

    Re: Complex cell layout

    Thanks for the answer.

     However, the code you have provided doesn't work for me. I get a runtime exception:

    Cannot add content of type 'Xceed.Wpf.DataGrid.UnboundColumn' to an object of type 'Xceed.Wpf.DataGrid.ColumnCollection'.  Error at object 'Xceed.Wpf.DataGrid.UnboundColumn' in markup file 'UnIfied.Module.TraderStation.OrderRouting;component/gui/wpf/blotter/strategyblotterview.xaml' 

    No matter how I specify the columns property

    <DataGrid:DataGridControl.Columns>
            <DataGrid:UnboundColumn Title="UnboundColumn" />

    </DataGrid:DataGridControl.Columns>  

     or

    <DataGrid:DataGridControl.Columns>

    <DataGrid:Column FieldName="Cancelable"/>

    <DataGrid:UnboundColumn Title="UnboundColumn" />

    <DataGrid:Column FieldName="Direction" />

    </DataGrid:DataGridControl.Columns>  

     

  •  01-22-2010, 9:56 AM Post no. 25518 in reply to 25517

    Re: Complex cell layout

    Ok, it works now. I had to specify a dummy FieldName (in the XAML EditRowColumn) for the UnboundColumn

    <DataGrid:Column FieldName="Description"/>
    <DataGrid:UnboundColumn FieldName="EditRowColumn" Title="Dummy column" CellContentTemplate="{StaticResource RequestedOrderTemplate}"/>

    Some kind of alchemy, though :)

View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.