Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
185
Xamgrid multiple point
posted

Hello,

I would like to use the same key on further columns on Xamgrid, how can i do ? 

At the moment i have an error on this point.

I'm doing something like this :

         <ig:XamGrid x:Name="dataGrid"
                    ItemsSource="{Binding Orders}">      

          <ig:XamGrid.Columns>             

<ig:TemplateColumn Key="Order" HeaderText="Update">
                        <ig:TemplateColumn.ItemTemplate>
                            <DataTemplate>
                                <Button Style="{StaticResource EditButtonStyle}" Height="18" Command="{Binding DataContext.DrawOrderDetail,RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ig:XamGrid}}}" CommandParameter="{Binding Order}"></Button>
                            </DataTemplate>
                        </ig:TemplateColumn.ItemTemplate>
                    </ig:TemplateColumn>
                    <ig:TemplateColumn  Key="Order" HeaderText="PDF">
                        <ig:TemplateColumn.ItemTemplate>
                            <DataTemplate>
                                <Button Style="{StaticResource FlatIconeButton}" BorderBrush="White" Background="White"
                                    Command="{Binding DataContext.DrawPDFCommand,RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ig:XamGrid}}}" CommandParameter="{Binding Order}"
                                    <ContentControl Style="{StaticResource PDF_ContentControlStyle}"  
                                                            BorderBrush="Black"/>
                                </Button>
                            </DataTemplate>
                        </ig:TemplateColumn.ItemTemplate>
                    </ig:TemplateColumn >

          </ig:XamGrid.Columns>

</xamgrid>

I just want to add button for each row... But for this column i don't really need key.

First problem :
I can't use Order because Orders is ObservableCollection<Order>, why ?
I can't use current row object ?
Can i use Self or Current keywords ?

Second problem :
I would like to use an empty key...
I didn't really need key in this case because i use parameter to call command action
How remove this key ?



-----------------------------------------------------------------------------------------------------

I have another problem on column with multiple value;
I'm trying to do this :

<ig:TemplateColumn Key="Person" HeaderText="Person" IsReadOnly="True" Width="100">
                        <ig:TemplateColumn.ItemTemplate>
                            <DataTemplate>
                                <TextBlock>
                                    <TextBlock.Text>
                                        <MultiBinding StringFormat="{}{0} {1}">
                                            <Binding Path="Person.Name"/>
                                            <Binding Path="Person.FirstName"/>
                                        </MultiBinding>
                                    </TextBlock.Text>
                                </TextBlock>
                            </DataTemplate>
                        </ig:TemplateColumn.ItemTemplate>
                    </ig:TemplateColumn>

When i group the table on this column i get an exception.

Did i have to do converter to be able to sort or group this column ?

Can i create columns with multiple key ?

I find solution to this problem, i put Key="Person.Name" to repolace Key="Person".

Thanks

Parents
  • 16495
    Offline posted

    Hello Gred,

    Thank you for your post.

    I was researching your issue and you need to set an unique  key for each column in the XamGrid. If you want you can use Unbound column and  TemplateColumn with different keys and bind them to the same property of your underline data. Our XamGrid control does not allow us to define several columns with same key.

    Would you please provide me with more details about what exactly you have in mind by  ‘current row object’ and ‘Current keywords’ in order to be able to research the issue. I created a sample application(XamGridKey.zip) based on your scenario, to show you how you can implement the functionality that you want to achieve.

    Please let me know if you need any further assistance on this matter.

     

    XamGridKey.zip
Reply Children