c# - Compile time error when styling BaseView like LoadingDecorator -
for instance have next code baseview:
using system.windows; using devexpress.xpf.core; namespace infrastructure.baseview { public class baseview : loadingdecorator { public baseview() { style = findresource("baseviewstyle") style; } } }
style:
<style targettype="{x:type baseview:baseview}" x:key="baseviewstyle" > <setter property="ownerlock" value="inputonly"/> <style.triggers> <datatrigger binding="{binding state}" d:datacontext="{d:designinstance type=baseviewmodel:baseviewmodel}"> <datatrigger.value> <enums:viewstate>busy</enums:viewstate> </datatrigger.value> <setter property="issplashscreenshown" value="true" /> </datatrigger> <datatrigger binding="{binding state}" d:datacontext="{d:designinstance type=baseviewmodel:baseviewmodel}"> <datatrigger.value> <enums:viewstate>default</enums:viewstate> </datatrigger.value> <setter property="issplashscreenshown" value="false" /> </datatrigger> </style.triggers> </style>
then create specific view this(name space definition not simple because view has complex ui):
<baseview:baseview x:class="general.views.projectlistview" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:baseview="clr-namespace:infrastructure.baseview;assembly=infrastructure" xmlns:viewmodels="clr-namespace:general.viewmodels" xmlns:dxprg="http://schemas.devexpress.com/winfx/2008/xaml/propertygrid" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid" xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars" mc:ignorable="d" d:designheight="300" d:designwidth="1000" d:datacontext="{d:designinstance type=viewmodels:projectlistviewmodel, isdesigntimecreatable=true}" x:name="view" ... </baseview:baseview>
in run time works perfect, have compile time error:
error 4 cannot create instance of "baseview".
and designer in vs not work. , in it's stacktrace can watch next information
at system.windows.style.checktargettype(object element)
at system.windows.stylehelper.updatestylecache(frameworkelement fe, frameworkcontentelement fce, style oldstyle, style newstyle, style& stylecache)
at system.windows.frameworkelement.onstylechanged(dependencyobject d, dependencypropertychangedeventargs e)
...
i realized problem in targettype="{x:type baseview:baseview}"
in style, without code style shows me errors , not works , understand it.
how can remove compile time error? ok use loadingdecorator
baseview? think if have views in display , of can busy, - not. so, thought good.
i use prism in app , thought take out loadingdecorator
in shell.xaml
beyond every regions in case don't understand how can bind issplashscreenshown
specific viewmodel of specific view.
Comments
Post a Comment