I have a TabControl, and on the second tab is a button:
<Button Name="deleteResourceBtn">
<Button.Style>
<Style TargetType="{x:Type Button}">
<Style.Triggers>
<DataTrigger Binding="{Binding SelectedIndex, ElementName=loadChartResourceListView}" Value="-1">
<Setter Property="IsEnabled" Value="False" />
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
<Image ToolTip="Delete Resource" Source="pack://application:,,,/...namespace omitted;component/Graphics/deleteBtn.png" Style="ButtonImageStyle" />
</Button>
I’m binding to a list control named loadChartResourceListView… the error I’m receiving is:
‘XamlParseException Set property
‘System.Windows.FrameworkElement.Style’
threw an exception.’ Line number ‘221’
and line position ’39’.
line 221 is </Style> … not really seeing an issue with my binding, unless the TabControl hasn’t loaded the second tab? Does a TabControl load tabs “on demand” ? Parhaps the second tab hasn’t loaded and its trying to bind?
If you look at the
InnerExceptionyou’ll see that you have anArgumentExceptionsayingSo I believe the error is coming from the
ImagestyleTry changing
Style="ButtonImageStyle"toStyle="{StaticResource ButtonImageStyle}"