Venugopal

Hi ,

I need to set Style property value is null. But through xaml.

For example :

<Style x:Key="{x:Type Button}" TargetType="{x:Type Button}">

<Setter Property="Style" Value="{x:Null}" />

</Style>

This is not possible in xaml . because its raising error like you can 't use style property in side of style.

But i need to set like this. Is there any other way for achieving this concept

Thanks in advance.

Thanks,

Venugopal.




Re: Windows Presentation Foundation (WPF) How can i set style=null through XAML.

Jan Ku?era

You mean you want pizza without pizza

I'm not sure what you intend here, but styles are applied all the time. You can't apply to no have style all the time, since you do this in a style. If you want to clear the style, you'd need to do it on some action or event.

Could you please more explain what behaviour you want to achieve





Re: Windows Presentation Foundation (WPF) How can i set style=null through XAML.

Venugopal

Hi,

Actually i am creating one application using global theme. I have three set of templates.

When ever i am changing my theme from the application . I am calling correspondant resource dictionay and its working fine. But i have one more theme. That is called None. If i call None means i need to remove existing theme. that means default template should come for all the controls. Seems that i can do using Style=null for every controls. But i dont want traverse all the object's in my application for setting style=null. For that only i am asking like this.

are you getting my point. Is this valid or not

Thanks,

Venugopal.






Re: Windows Presentation Foundation (WPF) How can i set style=null through XAML.

Jan Ku?era

Oh yes, I see know.

What about just declaring an empty style

<Style x:Key="{x:Type Button}" TargetType="{x:Type Button}" />





Re: Windows Presentation Foundation (WPF) How can i set style=null through XAML.

Yiling Lai

Actually, WPF has two styles: local style and theme style(aslo called default style). so even if you set style to null, it will use theme style. What effect do you really need .... This is reply to your first post, outdated Smile

=====

You can try to use this:

<Style BasedOn="{StaticResource {x:Type TextBlock}}" TargetType="{x:Type TextBlock}"/>






Re: Windows Presentation Foundation (WPF) How can i set style=null through XAML.

Jan Ku?era

Hello. By theme style, do you refer to the styles like Aero & Luna

I think Venugopal has its own set of local styles, each in different resource dictionary and he changes the set by changing the dictionary as the user wants and thus creating its own meaning of theme. In this context, his none theme means to clear all local styles and use theme(default) styles, or am I wrong





Re: Windows Presentation Foundation (WPF) How can i set style=null through XAML.

Venugopal

Hi ,

Yes, You are 100% correct.

Thanks,

Venugopal.






Re: Windows Presentation Foundation (WPF) How can i set style=null through XAML.

Jan Ku?era

So I suggested to set empty styles. An element can have only one local style set, so if you set it to an empty style, the previous one (themed) will be cleared and since you do not define anything in the empty style, only the generic Luna/Aero styles should be inherited in your controls, resulting in standard appearance.

Does it work





Re: Windows Presentation Foundation (WPF) How can i set style=null through XAML.

Venugopal

Hi Jan,

Great , seems its working. Really thanks for the help..

Thanks,

Venugopal.