Skip to main content

The problem is that the Template needs to know if what it is being applied to has a MouseEnter. Unfortunately even by applying your x:Type to the template, the xaml compiler doesn't have enough to go on.

I have done something similar before in getting the ResourceDictionary to recognise the porepotiesproperties of what I'm templating to and it looks like I used a style to get around it. Full code in http://winchrome.codeplex.com/SourceControl/latest#WinChrome/UI/VS2012ResourceDictionary.xaml.

<ResourceDictionary ... > <Style x:Key="CloseButtonStyle" TargetType="{x:Type Button}" > ... <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border x:Name="bd" ....> .... </Border> <ControlTemplate.Triggers> <Trigger Property="IsMouseOver" Value="True" SourceName="bd"> <Setter Property="Background" TargetName="bd" Value="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}"/> ... </Trigger> <Trigger Property="IsPressed" Value="True"> <Setter Property="Background" TargetName="bd"> ... </Setter> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> 

However you want to then bind your handler to a method on your objectDataPresenter via a {StaticResource ...} which I'm not sure that you can. Instead you might be better to instead bind onto the DataContext using a normal binding {Binding Path=...}, I think you might still be able to provide the DataContext via the {StaticResource.. }.

The problem is that the Template needs to know if what it is being applied to has a MouseEnter. Unfortunately even by applying your x:Type to the template, the xaml compiler doesn't have enough to go on.

I have done something similar before in getting the ResourceDictionary to recognise the porepoties of what I'm templating to and it looks like I used a style to get around it. Full code in http://winchrome.codeplex.com/SourceControl/latest#WinChrome/UI/VS2012ResourceDictionary.xaml.

<ResourceDictionary ... > <Style x:Key="CloseButtonStyle" TargetType="{x:Type Button}" > ... <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border x:Name="bd" ....> .... </Border> <ControlTemplate.Triggers> <Trigger Property="IsMouseOver" Value="True" SourceName="bd"> <Setter Property="Background" TargetName="bd" Value="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}"/> ... </Trigger> <Trigger Property="IsPressed" Value="True"> <Setter Property="Background" TargetName="bd"> ... </Setter> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> 

However you want to then bind your handler to a method on your objectDataPresenter via a {StaticResource ...} which I'm not sure that you can. Instead you might be better to instead bind onto the DataContext using a normal binding {Binding Path=...}, I think you might still be able to provide the DataContext via the {StaticResource.. }.

The problem is that the Template needs to know if what it is being applied to has a MouseEnter. Unfortunately even by applying your x:Type to the template, the xaml compiler doesn't have enough to go on.

I have done something similar before in getting the ResourceDictionary to recognise the properties of what I'm templating to and it looks like I used a style to get around it. Full code in http://winchrome.codeplex.com/SourceControl/latest#WinChrome/UI/VS2012ResourceDictionary.xaml.

<ResourceDictionary ... > <Style x:Key="CloseButtonStyle" TargetType="{x:Type Button}" > ... <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border x:Name="bd" ....> .... </Border> <ControlTemplate.Triggers> <Trigger Property="IsMouseOver" Value="True" SourceName="bd"> <Setter Property="Background" TargetName="bd" Value="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}"/> ... </Trigger> <Trigger Property="IsPressed" Value="True"> <Setter Property="Background" TargetName="bd"> ... </Setter> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> 

However you want to then bind your handler to a method on your objectDataPresenter via a {StaticResource ...} which I'm not sure that you can. Instead you might be better to instead bind onto the DataContext using a normal binding {Binding Path=...}, I think you might still be able to provide the DataContext via the {StaticResource.. }.

added 5 characters in body
Source Link
AlSki
  • 7k
  • 1
  • 28
  • 39

The problem is that the Template needs to know if what it is being applied to has a MouseEnter. Unfortunately even by applying your x:Type to the template, the xaml compiler doesn't have enough to go on.

I have done something similar before in getting the ResourceDictionary to recognise the porepoties of what I'm templating to and it looks like I used a style to get around it. Full code in http://winchrome.codeplex.com/SourceControl/latest#WinChrome/UI/VS2012ResourceDictionary.xaml.

<ResourceDictionary ... > <Style x:Key="CloseButtonStyle" TargetType="{x:Type Button}" > ... <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border x:Name="bd" ....> .... </Border> <ControlTemplate.Triggers> <Trigger Property="IsMouseOver" Value="True" SourceName="bd"> <Setter Property="Background" TargetName="bd" Value="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}"/> ... </Trigger> <Trigger Property="IsPressed" Value="True"> <Setter Property="Background" TargetName="bd"> ... </Setter> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> 

However you want to then bind your handler to a method on your objectDataPresenter via a {StaticResource ...} which I'm not sure that you can. Instead you might be better to instead bind onto the DataContext using a normal binding {Binding Path=, I think you might still be able to provide the ...}DataContext, I think you might still be able to provide the via theDataContext{StaticResource.. via the }`{StaticResource.. }.

The problem is that the Template needs to know if what it is being applied to has a MouseEnter. Unfortunately even by applying your x:Type to the template, the xaml compiler doesn't have enough to go on.

I have done something similar before in getting the ResourceDictionary to recognise the porepoties of what I'm templating to and it looks like I used a style to get around it. Full code in http://winchrome.codeplex.com/SourceControl/latest#WinChrome/UI/VS2012ResourceDictionary.xaml.

<ResourceDictionary ... > <Style x:Key="CloseButtonStyle" TargetType="{x:Type Button}" > ... <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border x:Name="bd" ....> .... </Border> <ControlTemplate.Triggers> <Trigger Property="IsMouseOver" Value="True" SourceName="bd"> <Setter Property="Background" TargetName="bd" Value="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}"/> ... </Trigger> <Trigger Property="IsPressed" Value="True"> <Setter Property="Background" TargetName="bd"> ... </Setter> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> 

However you want to then bind your handler to a method on your objectDataPresenter via a {StaticResource ...} which I'm not sure that you can. Instead you might be better to instead bind onto the DataContext using a normal binding {Binding Path=, I think you might still be able to provide the DataContextvia the{StaticResource.. }`.

The problem is that the Template needs to know if what it is being applied to has a MouseEnter. Unfortunately even by applying your x:Type to the template, the xaml compiler doesn't have enough to go on.

I have done something similar before in getting the ResourceDictionary to recognise the porepoties of what I'm templating to and it looks like I used a style to get around it. Full code in http://winchrome.codeplex.com/SourceControl/latest#WinChrome/UI/VS2012ResourceDictionary.xaml.

<ResourceDictionary ... > <Style x:Key="CloseButtonStyle" TargetType="{x:Type Button}" > ... <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border x:Name="bd" ....> .... </Border> <ControlTemplate.Triggers> <Trigger Property="IsMouseOver" Value="True" SourceName="bd"> <Setter Property="Background" TargetName="bd" Value="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}"/> ... </Trigger> <Trigger Property="IsPressed" Value="True"> <Setter Property="Background" TargetName="bd"> ... </Setter> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> 

However you want to then bind your handler to a method on your objectDataPresenter via a {StaticResource ...} which I'm not sure that you can. Instead you might be better to instead bind onto the DataContext using a normal binding {Binding Path=...}, I think you might still be able to provide the DataContext via the {StaticResource.. }.

added 21 characters in body
Source Link
AlSki
  • 7k
  • 1
  • 28
  • 39

The problem is that the Template needs to know if what it is being applied to has a MouseEnter. Unfortunately even by applying your x:Type to the template, the xaml compiler doesn't have enough to go on.

Temporary note: II have seen this oncedone something similar before in getting the ResourceDictionary to recognise the porepoties of what I'm templating to and can't remember howit looks like I gotused a style to get around it. Take a lookFull code in http://winchrome.codeplex.com/SourceControl/latest#WinChrome/UI/VS2012ResourceDictionary.xaml. I'll update this post as soon as I've got off this tube

<ResourceDictionary ... > <Style x:Key="CloseButtonStyle" TargetType="{x:Type Button}" > ... <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border x:Name="bd" ....> .... </Border> <ControlTemplate.Triggers> <Trigger Property="IsMouseOver" Value="True" SourceName="bd"> <Setter Property="Background" TargetName="bd" Value="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}"/> ... </Trigger> <Trigger Property="IsPressed" Value="True"> <Setter Property="Background" TargetName="bd"> ... </Setter> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> 

However you want to then bind your handler to a method on your objectDataPresenter via a {StaticResource ...} which I'm not sure that you can. Instead you might be better to instead bind onto the DataContext using a normal binding {Binding Path=, I think you might still be able to provide the DataContextvia the{StaticResource.. }`.

The problem is that the Template needs to know if what it is being applied to has a MouseEnter. Unfortunately even by applying your x:Type to the template, the xaml compiler doesn't have enough to go on.

Temporary note: I have seen this once before and can't remember how I got around it. Take a look in http://winchrome.codeplex.com/SourceControl/latest#WinChrome/UI/VS2012ResourceDictionary.xaml. I'll update this post as soon as I've got off this tube.

The problem is that the Template needs to know if what it is being applied to has a MouseEnter. Unfortunately even by applying your x:Type to the template, the xaml compiler doesn't have enough to go on.

I have done something similar before in getting the ResourceDictionary to recognise the porepoties of what I'm templating to and it looks like I used a style to get around it. Full code in http://winchrome.codeplex.com/SourceControl/latest#WinChrome/UI/VS2012ResourceDictionary.xaml.

<ResourceDictionary ... > <Style x:Key="CloseButtonStyle" TargetType="{x:Type Button}" > ... <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border x:Name="bd" ....> .... </Border> <ControlTemplate.Triggers> <Trigger Property="IsMouseOver" Value="True" SourceName="bd"> <Setter Property="Background" TargetName="bd" Value="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}"/> ... </Trigger> <Trigger Property="IsPressed" Value="True"> <Setter Property="Background" TargetName="bd"> ... </Setter> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> 

However you want to then bind your handler to a method on your objectDataPresenter via a {StaticResource ...} which I'm not sure that you can. Instead you might be better to instead bind onto the DataContext using a normal binding {Binding Path=, I think you might still be able to provide the DataContextvia the{StaticResource.. }`.

added 21 characters in body
Source Link
AlSki
  • 7k
  • 1
  • 28
  • 39
Loading
Source Link
AlSki
  • 7k
  • 1
  • 28
  • 39
Loading