So This is (a part of) my border in the xaml
<DataTemplate DataType="{x:Type viewModel:FunctionProviderViewModel}">
<Border Margin="4"
Background="PapayaWhip"
CornerRadius="4"
IsEnabled="{Binding IsSimpleModeActive}"
Style="{StaticResource ResourceKey=AcpBorder}">
Im populating a Control with this DataTemplate. I added another Border with x:Key="SimpleAcpBorder"
and i added a bool to my viewmodel (which will is bound to a checkbox). Now i want to set the style to simple if the checkbox is checked and to regular else. Does anybody know how to achieve this?
thanks in advance!
EDIT:
my datatemplate looks like this now
<DataTemplate DataType="{x:Type viewModel:FunctionProviderViewModel}">
<Border Background="PapayaWhip">
<Border.Style>
<Style TargetType="Border"
BasedOn="{StaticResource ResourceKey=AcpBorder}">
<Style.Triggers>
<DataTrigger Binding="{Binding IsSimpleModeActive}"
Value="True">
<Setter Property="Margin"
Value="0" />
<Setter Property="CornerRadius"
Value="0" />
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<Border.Effect>
<DropShadowEffect BlurRadius="10" ShadowDepth="5" />
</Border.Effect>
<TreeViewItem VerticalContentAlignment="Center"
Background="Transparent"
and in another xaml my AcpBoarder stays untouched:
<Style x:Key="AcpBorder"
TargetType="Border">
<Setter Property="VerticalAlignment"
Value="Stretch" />
<Setter Property="CornerRadius"
Value="3" />
<Setter Property="Padding"
Value="4" />
<Setter Property="Margin"
Value="2" />
</Style>
But somehow the Trigger doesnt seem to work for me. Any ideas?
Thank you very much
EDIT2:
System.Windows.Data Warning: 56 : Created BindingExpression (hash=54724182) for Binding (hash=28450086) System.Windows.Data Warning: 58 : Path: 'IsSimpleModeActive' System.Windows.Data Warning: 60 : BindingExpression (hash=54724182): Default mode resolved to OneWay System.Windows.Data Warning: 61 : BindingExpression (hash=54724182): Default update trigger resolved to PropertyChanged System.Windows.Data Warning: 62 : BindingExpression (hash=54724182): Attach to System.Windows.Controls.Border.NoTarget (hash=22755592) System.Windows.Data Warning: 67 : BindingExpression (hash=54724182): Resolving source System.Windows.Data Warning: 70 : BindingExpression (hash=54724182): Found data context element: Border (hash=22755592) (OK) System.Windows.Data Warning: 78 : BindingExpression (hash=54724182): Activate with root item FunctionProviderViewModel (hash=3473742) System.Windows.Data Warning: 107 : BindingExpression (hash=54724182): At level 0 using cached accessor for FunctionProviderViewModel.IsSimpleModeActive: RuntimePropertyInfo(IsSimpleModeActive) System.Windows.Data Warning: 104 : BindingExpression (hash=54724182): Replace item at level 0 with FunctionProviderViewModel (hash=3473742), using accessor RuntimePropertyInfo(IsSimpleModeActive) System.Windows.Data Warning: 101 : BindingExpression (hash=54724182): GetValue at level 0 from FunctionProviderViewModel (hash=3473742) using RuntimePropertyInfo(IsSimpleModeActive): 'False' System.Windows.Data Warning: 80 : BindingExpression (hash=54724182): TransferValue - got raw value 'False' System.Windows.Data Warning: 89 : BindingExpression (hash=54724182): TransferValue - using final value 'False' The thread '' (0x454) has exited with code 0 (0x0).