开发者

MultiDataTrigger with value range

I have several conditions that need to be met in order to allow a user to ed开发者_开发技巧it the details of the selected item.

the conditions are:

if the item is active they are allowed to edit it regardless of security level. No problem there.

if the item is inactive: users above security level 50 can edit it users below security level 50 can only view it

currently I am using a multidatatrigger to do this:

<MultiDataTrigger>
                    <MultiDataTrigger.Conditions>
                        <Condition Binding="{Binding Active,Converter={StaticResource DebugConverter}}"
                                   Value="False" />
                        <Condition Binding="{Binding SelectedOffice}" />
                    </MultiDataTrigger.Conditions>
                    <Setter Property="ContentTemplate"
                            Value="{DynamicResource InActiveOfficeDataTemplate}" />
                </MultiDataTrigger>
                <MultiDataTrigger>
                    <MultiDataTrigger.Conditions>
                        <Condition Binding="{Binding Active,Converter={StaticResource DebugConverter}}"
                                   Value="True" />
                        <Condition Binding="{Binding SelectedOffice}" />
                    </MultiDataTrigger.Conditions>
                    <Setter Property="ContentTemplate"
                            Value="{DynamicResource ActiveOfficeDataTemplate}" />
                </MultiDataTrigger>

I also need to know when the Selected Office changes. I was hoping to monitor the PhysicianId but I wont know what the number is, only that its changed. I have a selectedoffice property that the listbox is bound to, but I imagine I have to do something with the datatrigger to make it fire.


CHANGES

<DataTrigger Binding="{Binding Active}"
                             Value="False">
                    <Setter Property="ContentTemplateSelector"
                            Value="{DynamicResource DoctorOfficesDataTemplateSelector}" />
                </DataTrigger>
                <DataTrigger Binding="{Binding Active,Converter={StaticResource DebugConverter}}"
                             Value="True">
                    <Setter Property="ContentTemplate"
                            Value="{DynamicResource ActiveOfficeDataTemplate}" />
                </DataTrigger>

This seems to be working. I have the security level actually being checked in the templateselector.

The issue remains though that the selecteddoctor is only being updated when I change between an inactive and active office. If i choose and active then an active the trigger isnt firing again...I have the list bound to an Icollection do I need to make it observable? this was working correctly before i implemented the datatrigger.


for the time being I just databound the isenabled to the isactive field on the office. its not pretty but it works for now

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜