Page 1 of 1

[SOLVED] Designer preview issue when used with common style

Posted: Thu Feb 23, 2017 5:07 am
by sd1388
Hi Team,

I have used DefaultStyle.xaml in project where all common styles are defined. I then merged that defaultstyle with App.xaml using following syntax.

<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="DefaultStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

After doing this, I am not able to view design in designer but styling is properly applied when page is rendered on browser.
We are not able to see actual design in designer which consumes our time to judge when placing controls on UI.

Is it known behaviour or I am missing any configuration?

Please suggest.

Thanks.

Re: Designer preview issue when used with common style

Posted: Tue Feb 28, 2017 6:51 am
by sd1388
Hi Team,

Any update on this?

Thanks

Re: Designer preview issue when used with custom style

Posted: Tue Feb 28, 2017 6:04 pm
by tomny
Hi,

Does not support the implicit style, all styles should use "key" to set.

Regards,
Tomny

Re: Designer preview issue when used with custom style

Posted: Wed Mar 01, 2017 10:23 pm
by sd1388
Hi,
Yes, I have already used Key attribute for custom style. design is still not shown on designer but styling is properly applied when viewed in browser.

Thanks.

Re: Designer preview issue when used with common style

Posted: Thu Mar 23, 2017 5:21 am
by sd1388
Hi Team,

Any update on this. ?

PFA sample for your reference.
MyTestValidation.rar
(413.38 KiB) Downloaded 391 times


I have written TextBlockStyle in DefaultStyle.xaml and referred in MainPage.xaml. It affects designer preview and thus design can't be seen.

DefaultStyle.xaml-

Code: Select all

<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:MyTestValidation">
    <Style x:Key="TextBlockStyle" TargetType="TextBlock">
        <Setter Property="Foreground" Value="Green"/>
    </Style>

</ResourceDictionary>


MainPage.xaml-

Code: Select all

<TextBlock Text="Your First Name: " Style="{StaticResource TextBlockStyle}"/>


Does common style work? or shall I have to use inline style approach?

Please share sample of common style if it is working.

Thanks.

Re: Designer preview issue when used with common style

Posted: Thu Mar 23, 2017 6:09 am
by JS-Support @Userware
Hi,

Yes, common styles do work.

However, the XAML Designer Preview does not support them. They will work fine when you launch the final application (both in the Simulator and in the Browser). Your "MergedDictionaries" is the correct one. We will add support for the XAML Designer Preview in the future.

Thanks a lot,
Regards,
JS-Support

Re: Designer preview issue when used with common style

Posted: Fri Aug 11, 2017 7:34 am
by JS-Support @Userware
Hi,

This is now supported starting in Beta 11.8 and newer (May 2017). You can download the latest build from:
http://forums.cshtml5.com/viewforum.php?f=6

Regards,
JS-Support