locked
Sample data in Blend at design time when editing resources

    Question

  • Hi,

    I have a GridView with sample data in Blend. I can click on edit item template and everything works as it should. I can see the sample data when editing the template.

    But now I added an item template selector. The button to edit the template is greyed out. I can search for the different item templates in the resources window and right click -> edit. But there is no sample data. Is it possible to add a default value or something similar?

    This way I can not see the text nor a color:

    <TextBlock Text="{Binding txt}" Foreground="{Binding ForegroundBrush}"

    Best Regards

    Wednesday, February 27, 2013 12:31 PM

Answers

  • This is limitation in Blend at this point. As you are using a ItemTemplate selector and setting the data template in code, we are currently have no way of knowing which resource it corresponds to. Saying that, I will definitely take this feedback back to my team.


    Dev@Mic

    Friday, March 08, 2013 11:28 PM

All replies

  • Hi piratezstick,

    I don't quite understand your scenario. Could you please kindly elaborate how did you set teh sample data, and exact which template did you edit?

    Thanks!


    Min Zhu
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, February 28, 2013 4:40 AM
    Moderator
  • For example:

    <ListBox ItemsSource="{Binding Source={StaticResource groupedItemsViewSourceInput}}" ...
    
    <CollectionViewSource x:Name="groupedItemsViewSourceInput" Source="{Binding Groups}" IsSourceGrouped="true" ItemsPath="TopItems"
        		d:Source="{Binding AllGroups, Source={d:DesignInstance IsDesignTimeCreatable=True, Type=Data:SampleDataSource2}}"/>

    Now I right click on the list box -> Edit additional templates -> item template.

    Then I see the first item from my sample data in the template and I can edit:

    <DataTemplate x:Key="DataTemplateInputUnit">
    			<Grid Height="44" Width="280" 
    					<TextBlock Text="{Binding Subtitle}"/>
    			</Grid>
    </DataTemplate>

    But if I am using an item template selector "Edit additional templates -> item template" is disabled. I can go to the resources window and right click -> edit. But there is no sample data. So in this case it will not display a text an therefore I can't see it so editing is a bit hard.

    Best Regards

    Monday, March 04, 2013 11:39 AM
  • This is limitation in Blend at this point. As you are using a ItemTemplate selector and setting the data template in code, we are currently have no way of knowing which resource it corresponds to. Saying that, I will definitely take this feedback back to my team.


    Dev@Mic

    Friday, March 08, 2013 11:28 PM
  • Ok. So is there another way to display sample data here?
    Saturday, March 09, 2013 12:51 AM
  • With this limiation, you might need to create a seperate project to play with the DataTemplate in the designer.

    I am closing this thread as answered. Feel free to post back if you have any update.


    Min Zhu
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, March 21, 2013 5:14 AM
    Moderator