VirtualQueryableCollectionView, EntityFramework and MVVM

3 posts, 0 answers
  1. Dario Concilio
    Dario Concilio avatar
    129 posts
    Member since:
    Apr 2016

    Posted 29 Apr Link to this post

    Hi to all,

    I'm developing a MVVM Application, I have a global context for application, I have a provider class that exposes me a method that returns a List<MyModel>

    MyModel is a class that I use internally in application:

    My entityframework context (EF5 & FW4.0) exposes MyTable (this table corresponde to MyModel class).

    My provider get IQuarable<MyTable> by linq and convert all items in MyModel, then return List<MyModel>.

    Now, If I have a lot of records and I have to show all items into ComboBox, I could user VirtualQueryableCollectionView.

    But how can I use List<MyModel> to do this? I will get the same result?

  2. Stefan X1
    Admin
    Stefan X1 avatar
    523 posts

    Posted 03 May Link to this post

    Hi Potito,

    Can you please check out the VirtualQueryableCollectionView API Reference? As shown in it, the contstructor of VQCV accepts an IEnumerable as a parameter, so you should be able to pass the fetched collection to it.

    Can you please check it out and let me know in case I am missing something?

    All the best,
    Stefan X1
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Dario Concilio
    Dario Concilio avatar
    129 posts
    Member since:
    Apr 2016

    Posted 03 May in reply to Stefan X1 Link to this post

    At the end I choose use this approach:

    I used List<MyModel> and add tag <VirtualizingStackPanel/>

    I got the desired result :-)

    <telerik:RadComboBox ItemTemplate="{StaticResource ComboBoxTemplate}"
                     ClearSelectionButtonVisibility="Visible"
                     ClearSelectionButtonContent="Cancella selezione"
                     ItemsSource="{Binding SottoConti}"
                     EmptySelectionBoxTemplate="{StaticResource EmptyTemplate}"
                     SelectedItem="{Binding Path=ContoContabile,Mode=TwoWay,ElementName=userControl}">
        <telerik:RadComboBox.ItemsPanel>
            <ItemsPanelTemplate>
                <VirtualizingStackPanel />
            </ItemsPanelTemplate>
        </telerik:RadComboBox.ItemsPanel>
        <telerik:RadComboBox.FilteringBehavior>
            <filter:SottoContiFilteringBehavior />
        </telerik:RadComboBox.FilteringBehavior>
    </telerik:RadComboBox>

Back to Top