Login
Portfolio Management & My Site Ver2.2b    RSS   RSS 2.0

   휴지통

   찾기
작성자              : Until
제목                  : [WPF] MultiDataTrigger와 DataTrigger with multibinding의 차이
내용                  :

MultiDataTrigger vs DataTrigger with multibinding


I encountered a situation where I can easily achieve the same functionality by using a MultiDataTrigger or, alternately, using a DataTrigger with a MultiBinding. Are there any substantive reasons to prefer one approach over the other?

With MultiDataTrigger:

<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding Path=SomePath}" Value="SomeValue"/>
<Condition Binding="{Binding Path=SomeOtherPath, Converter={StaticResource SomeConverter}}" Value="SomeOtherValue"/>
</MultiDataTrigger.Conditions>
<MultiDataTrigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource MyStoryboard}"/>
</MultiDataTrigger.EnterActions>
</MultiDataTrigger>

With MultiBinding:

<DataTrigger Value="foo">
<DataTrigger.Binding>
<MultiBinding Converter="{StaticResource fooConv}"/>
<Binding Path=SomePath/>
<Binding Path=SomeOtherPath/>
</MultiBinding>
</DataTrigger.Binding>
<DataTrigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource MyStoryboard}"/>
</DataTrigger.EnterActions>
</DataTrigger>


Answer

Multibinding requires a converter for all but the rarest circumstances (using StringFormat).

MultiTrigger only requires a converter to get your binding results into booleans.

파일첨부 첨부파일
Until
(2016-01-28)
참고 - http://stackoverflow.com/questions/20993293/multidatatrigger-vs-datatrigger-with-multibinding                        
COMMENT
파일첨부