c# - How do i force a wpf window/control refresh of disabled elements -


i pulling out hair trying figure out why normal dispatcher.invoke command did not work redrawing window, issue seems related content being disabled. i'm using dotnet 4.0 full framework.

if use

private void dosomething() {   handlebusyenabledisable(false);   dosomethingthatkeepsitbusy();   handlebusyenabledisable(true); }  private void handlebusyenabledisable(bool enabling) {   cursor = enabling ? cursors.arrow : cursors.wait;    canvasfunctions.isenabled = enabling;   canvasright.isenabled = enabling;   canvasright.dispatcher.invoke(system.windows.threading.dispatcherpriority.render, emptydelegate); 

i see cursor change content not disabled. if add

canvasright.opacity = enabling ? 1 : .5; 

then think works, sometimes. there else can do?
task that's running validating user entered data, easier run on gui thread. shouldn't hard.

not controls visually represent being disabled, may note wont usable client side.

to frank should implement inotifychanged , bind enabled field property. make sure controls enable/disable binding framework correct dispatches isenabled believe registered affectsrender invalidate control's visual state , force re-draw.

also should use style adjust visual state of control:

<style targettype="grid">   <style.triggers>     <datatrigger property="isenabled" value="false">        <setter property="opacity" value="0.5" />     </datatrigger>   </style.triggers> </style> 

Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -