c# - DataTrigger on a specific Type -


i have scenario need specify functions like

void somefunction(int value) 

for i'm using 2 datagrids.

  • the left datagrid holds functions
  • the right datagrid holds parameters selected function

i want parameter datagrid enabled when valid function selected in function datagrid. if newitemplaceholder (the last row when canuseraddrows="true" datagrid) selected or if selection empty want disabled. experimentet datatrigger couldn't work

<style targettype="datagrid">     <setter property="isenabled" value="false"/>     <style.triggers>         <datatrigger binding="{binding elementname=functiondatagrid,                                        path=selecteditem}"                      value="{x:type systemdata:datarowview}">             <setter property="isenabled" value="true"/>         </datatrigger>     </style.triggers> </style> 

is possible check if value produced binding of specific type? otherwise, have other solutions this? of now, i'm handling selectedcellschanged event prefer not using code behind

thanks

if else comes across same problem, here's did solve it. created typeofconverter returns type of value produced binding.

<datatrigger binding="{binding elementname=functionsdatagrid,                                path=selecteditem,                                converter={staticresource typeofconverter}}"              value="{x:type data:datarowview}">     <setter property="isenabled" value="true"/> </datatrigger> 

typeofconverter

public class typeofconverter : ivalueconverter {     public object convert(object value, type targettype, object parameter, system.globalization.cultureinfo culture)     {         return (value == null) ? null : value.gettype();     }     public object convertback(object value, type targettype, object parameter, system.globalization.cultureinfo culture)     {         throw new notimplementedexception();     } } 

Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -