QueryableCollectionView & Blend - design time data

3 posts, 0 answers
  1. Scott
    Scott avatar
    13 posts
    Member since:
    Apr 2011

    Posted 30 Apr 2011 Link to this post

    Greetings Telerik Team!

    Running an SL4 app with Telerik Q1 2011 toolkit with Mvvm Light

    I had been using a dataform/radGridView together with an ObservableCollection which, among other things, was giving me design time data in blend. I wanted to include a datapager, and switched to a QueryableCollectionView bound to the itemssource/source of my dataform/radgridview/raddatapager. Upon doing so, I could no longer see my design time data in blend.

    I'm using a service interface which implements a base class that uses the DesignerProperties.IsInDesignTool property to determine whether I should return a design time service or my run time web service.

    Is the QCV not blendable?

    Here's my ViewModel

    public void LoadAccounts()
        Accounts = null;
        AccountService.GetAccounts(App.CurrentUser.ToString(), GetAccountsCallback);
    private void GetAccountsCallback(ObservableCollection<TSMVVM.Model.Accounts> accounts)
        if (accounts != null)
                 if (accounts.Count > 0) {
                 Accounts = new QueryableCollectionView(accounts)
                 SelectedAccount = null;
    private QueryableCollectionView _accounts;
    public QueryableCollectionView Accounts
                get { return _accounts; }
                    _accounts = value;

    <toolkit:DataForm x:Name="dataForm"
        Header="Account Definition"
        Width="{Binding Width, ElementName=GV1}"
        ItemsSource="{Binding Accounts}"
        CurrentItem="{Binding SelectedAccount}"
        Margin="0,0,0,10" >
    <telerik:RadGridView ItemsSource="{Binding Accounts}"
        HeaderRowStyle="{StaticResource CSAgvHeaderRowStyle}"
        SelectedItem="{Binding SelectedAccount, Mode=TwoWay}"
            <telerik:GridViewDataColumn HeaderCellStyle="{StaticResource CSAgvHeaderCellStyle}" DataMemberBinding="{Binding AccountNumber}"/>
            <telerik:GridViewDataColumn HeaderCellStyle="{StaticResource CSAgvHeaderCellStyle}" DataMemberBinding="{Binding AccountDescription}" Width="*"/>
    <telerik:RadDataPager Grid.Row="1" Source="{Binding Accounts}" PageSize="10"/>
  2. Vlad
    Vlad avatar
    11100 posts

    Posted 02 May 2011 Link to this post


     As far as I know you will not have any problems to use QueryableCollectionView in both Blend and Visual Studio design-time however you need to bind in some design-time aware way - not in code. For example using StaticResource.

    I've attached small example application and two screenshots from Blend and Visual Studio. 

    All the best,
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Scott
    Scott avatar
    13 posts
    Member since:
    Apr 2011

    Posted 02 May 2011 Link to this post

    I think I have to disagree with your statement that you can't use code. If you can't use code, the DesignerProperties API wouldn't exist. I use this code to return design time data:

    public static ServiceProviderBase Instance
        get { return _instance ?? CreateInstance();
    static ServiceProviderBase CreateInstance()
        return _instance = DesignerProperties.IsInDesignTool ?
                    (ServiceProviderBase)new DesignServices.DesignServiceProvider() : new Services.ServiceProvider();

    So when I'm loading my Accounts view, it hits this interface. IsInDesignTool evaluates to true, and it returns an instance of my designserviceprovider, which goes out to get data generated in my DesignAccounts, here:

    public DesignAccounts()
        for (int i = 0; i < 20; i++)
    private TSMVVM.Model.Accounts CreateDesignAccount(int i)
        var account = new TSMVVM.Model.Accounts()
            AccountDescription = "Account" + i,
             AccountNumber = (i >= 10) ? "000.00" + i : "000.000" + i,
        return account;

    As I said, this works with an ObservableCollection<Accounts>, but not a QueryableCollectionView(Accounts).
Back to Top