It could just be a typing error, but this property wouldn't work:
public Visibility GridColVisibility
{
get { return GridColVisibility; }
set { GridColVisibility= value; RaisePropertyChanged(() => GridColVisibility); }
}
You can't use the property name inside the property like that... you'd get an error. You need a private
member to back your property... something like this:
private Visibility gridColVisibility;
public Visibility GridColVisibility
{
get { return gridColVisibility; }
set { gridColVisibility = value; RaisePropertyChanged(() => GridColVisibility); }
}
However... I'm going to assume that this was just a typing error.
Looking at your DataTrigger
, I can't really see anything that is obviously wrong, so I can only assume that your Binding Path
is incorrect... if it is, then look in the Output Window in Visual Studio and you should find details of the error. This small example shows that it is definitely possible to set the Grid.ColumnSpan
property in a DataTrigger
:
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Rectangle Fill="LightGreen">
<Rectangle.Style>
<Style>
<Style.Triggers>
<Trigger Property="UIElement.IsMouseOver" Value="True">
<Setter Property="Grid.ColumnSpan" Value="2" />
</Trigger>
</Style.Triggers>
</Style>
</Rectangle.Style>
</Rectangle>
</Grid>
So I think that unfortunately, given the information that you have provided, you are the only one that can really find your mistake... I'd take a good look at that Binding Path
if I were you.