0 Replies - 7011 Views - Last Post: 24 July 2013 - 08:56 AM Rate Topic: -----

#1 solarissf  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 36
  • Joined: 27-March 12

wpf databound datagrid - how to prevent duplications

Posted 24 July 2013 - 08:56 AM

Using WPF, I have a datagrid, databound to a observable collection/collectionviewsource.

Say my grid has only 1 column ("NAME").
How can I make sure I only populate the grid with NO duplications.

I've looked at multivalue converters... validationRules.

Either way, I don't know how to display values with no duplications.

Any assistance would be GREATLY appreciated.
Thanks

     <DataGrid.Columns>
                            <DataGridTextColumn Header="Market">
                                <DataGridTextColumn.Binding>
                                    <MultiBinding Converter="{StaticResource ResourceKey=myConverter}">
                                        <Binding Path="tMarketName" UpdateSourceTrigger="PropertyChanged">
                                            <Binding.ValidationRules>
                                                <local:UniqueNameValidation CurrentCollection="{StaticResource ResourceKey=ViewSource}"/>
                                            </Binding.ValidationRules>    
                                        </Binding>
                                        <Binding RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType={x:Type DataGrid}, AncestorLevel=1}"/>
                                        <Binding Path="."/>
                                        <Binding Source="{StaticResource ResourceKey=MyData}"/>
                                    </MultiBinding>
                                </DataGridTextColumn.Binding>
                            </DataGridTextColumn>



Is This A Good Question/Topic? 0
  • +

Page 1 of 1