how to load my style file instead of generic.xaml while applying style in window wpf
up vote
-1
down vote
favorite
I have WPF project, in which i have applied style from another assembly in window for entire application. But, one of my custom control which is used inside the application doesn't take the style. It's style get always loaded from generic.xaml.
In this custom control class, I have set the DefaultStyleKey property and also the external style file gets added in merged dictionary of Application's resource dictionary. Can anyone face this kind of issue?
Note: Style for other controls gets applied from another aasembly
<Window x:Class="WpfApplication_CalenderEdit.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApplication_CalenderEdit"
xmlns:thirdParty=""
mc:Ignorable="d" thirdParty.Style="ThemeNew"
xmlns:ie="http://schemas.microsoft.com/expression/2010/interactivity"
WindowStartupLocation="CenterScreen"
Title="Calendar Sample" Height="450" Width="625" >
<!--<Window.DataContext>
<local:ViewModel/>
</Window.DataContext>-->
<Grid >
<!--<DockPanel>-->
<StackPanel >
<Calendar WeekNumberForeground="Red" Padding="10" />
<ComboBox Margin="20" Height="35" Width="150"/>
</StackPanel>
wpf styles themes
add a comment |
up vote
-1
down vote
favorite
I have WPF project, in which i have applied style from another assembly in window for entire application. But, one of my custom control which is used inside the application doesn't take the style. It's style get always loaded from generic.xaml.
In this custom control class, I have set the DefaultStyleKey property and also the external style file gets added in merged dictionary of Application's resource dictionary. Can anyone face this kind of issue?
Note: Style for other controls gets applied from another aasembly
<Window x:Class="WpfApplication_CalenderEdit.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApplication_CalenderEdit"
xmlns:thirdParty=""
mc:Ignorable="d" thirdParty.Style="ThemeNew"
xmlns:ie="http://schemas.microsoft.com/expression/2010/interactivity"
WindowStartupLocation="CenterScreen"
Title="Calendar Sample" Height="450" Width="625" >
<!--<Window.DataContext>
<local:ViewModel/>
</Window.DataContext>-->
<Grid >
<!--<DockPanel>-->
<StackPanel >
<Calendar WeekNumberForeground="Red" Padding="10" />
<ComboBox Margin="20" Height="35" Width="150"/>
</StackPanel>
wpf styles themes
How did you "appy the style from another assembly in window for entire application"? Do the same for the custom control.
– mm8
Nov 7 at 12:51
I have my theme file in third party library. I included it's assembly in my project and setting style globally in window
– Keerthana
Nov 8 at 6:19
add a comment |
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
I have WPF project, in which i have applied style from another assembly in window for entire application. But, one of my custom control which is used inside the application doesn't take the style. It's style get always loaded from generic.xaml.
In this custom control class, I have set the DefaultStyleKey property and also the external style file gets added in merged dictionary of Application's resource dictionary. Can anyone face this kind of issue?
Note: Style for other controls gets applied from another aasembly
<Window x:Class="WpfApplication_CalenderEdit.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApplication_CalenderEdit"
xmlns:thirdParty=""
mc:Ignorable="d" thirdParty.Style="ThemeNew"
xmlns:ie="http://schemas.microsoft.com/expression/2010/interactivity"
WindowStartupLocation="CenterScreen"
Title="Calendar Sample" Height="450" Width="625" >
<!--<Window.DataContext>
<local:ViewModel/>
</Window.DataContext>-->
<Grid >
<!--<DockPanel>-->
<StackPanel >
<Calendar WeekNumberForeground="Red" Padding="10" />
<ComboBox Margin="20" Height="35" Width="150"/>
</StackPanel>
wpf styles themes
I have WPF project, in which i have applied style from another assembly in window for entire application. But, one of my custom control which is used inside the application doesn't take the style. It's style get always loaded from generic.xaml.
In this custom control class, I have set the DefaultStyleKey property and also the external style file gets added in merged dictionary of Application's resource dictionary. Can anyone face this kind of issue?
Note: Style for other controls gets applied from another aasembly
<Window x:Class="WpfApplication_CalenderEdit.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApplication_CalenderEdit"
xmlns:thirdParty=""
mc:Ignorable="d" thirdParty.Style="ThemeNew"
xmlns:ie="http://schemas.microsoft.com/expression/2010/interactivity"
WindowStartupLocation="CenterScreen"
Title="Calendar Sample" Height="450" Width="625" >
<!--<Window.DataContext>
<local:ViewModel/>
</Window.DataContext>-->
<Grid >
<!--<DockPanel>-->
<StackPanel >
<Calendar WeekNumberForeground="Red" Padding="10" />
<ComboBox Margin="20" Height="35" Width="150"/>
</StackPanel>
wpf styles themes
wpf styles themes
edited Nov 8 at 8:44
asked Nov 7 at 9:10
Keerthana
484
484
How did you "appy the style from another assembly in window for entire application"? Do the same for the custom control.
– mm8
Nov 7 at 12:51
I have my theme file in third party library. I included it's assembly in my project and setting style globally in window
– Keerthana
Nov 8 at 6:19
add a comment |
How did you "appy the style from another assembly in window for entire application"? Do the same for the custom control.
– mm8
Nov 7 at 12:51
I have my theme file in third party library. I included it's assembly in my project and setting style globally in window
– Keerthana
Nov 8 at 6:19
How did you "appy the style from another assembly in window for entire application"? Do the same for the custom control.
– mm8
Nov 7 at 12:51
How did you "appy the style from another assembly in window for entire application"? Do the same for the custom control.
– mm8
Nov 7 at 12:51
I have my theme file in third party library. I included it's assembly in my project and setting style globally in window
– Keerthana
Nov 8 at 6:19
I have my theme file in third party library. I included it's assembly in my project and setting style globally in window
– Keerthana
Nov 8 at 6:19
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
You should explicitly apply the same Style also for your custom window, e.g.:
<Style TargetType="{x:Type Window}" BasedOn="{StaticResource CustomStyle}" />
<Style TargetType="{x:Type controls:CustomWindow}" BasedOn="{StaticResource CustomStyle}" />
Am not using custom window, I have set style in the window from which style get applied to all the controls defined inside the window
– Keerthana
Nov 8 at 6:20
1
@Keerthana: Please post your XAML to clarify your issue.
– mm8
Nov 8 at 8:10
posted the xaml code, also style gets applied when it is set directly to the control example: <Calendar thridParty="ThemeNew"/>
– Keerthana
Nov 8 at 8:44
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
You should explicitly apply the same Style also for your custom window, e.g.:
<Style TargetType="{x:Type Window}" BasedOn="{StaticResource CustomStyle}" />
<Style TargetType="{x:Type controls:CustomWindow}" BasedOn="{StaticResource CustomStyle}" />
Am not using custom window, I have set style in the window from which style get applied to all the controls defined inside the window
– Keerthana
Nov 8 at 6:20
1
@Keerthana: Please post your XAML to clarify your issue.
– mm8
Nov 8 at 8:10
posted the xaml code, also style gets applied when it is set directly to the control example: <Calendar thridParty="ThemeNew"/>
– Keerthana
Nov 8 at 8:44
add a comment |
up vote
0
down vote
You should explicitly apply the same Style also for your custom window, e.g.:
<Style TargetType="{x:Type Window}" BasedOn="{StaticResource CustomStyle}" />
<Style TargetType="{x:Type controls:CustomWindow}" BasedOn="{StaticResource CustomStyle}" />
Am not using custom window, I have set style in the window from which style get applied to all the controls defined inside the window
– Keerthana
Nov 8 at 6:20
1
@Keerthana: Please post your XAML to clarify your issue.
– mm8
Nov 8 at 8:10
posted the xaml code, also style gets applied when it is set directly to the control example: <Calendar thridParty="ThemeNew"/>
– Keerthana
Nov 8 at 8:44
add a comment |
up vote
0
down vote
up vote
0
down vote
You should explicitly apply the same Style also for your custom window, e.g.:
<Style TargetType="{x:Type Window}" BasedOn="{StaticResource CustomStyle}" />
<Style TargetType="{x:Type controls:CustomWindow}" BasedOn="{StaticResource CustomStyle}" />
You should explicitly apply the same Style also for your custom window, e.g.:
<Style TargetType="{x:Type Window}" BasedOn="{StaticResource CustomStyle}" />
<Style TargetType="{x:Type controls:CustomWindow}" BasedOn="{StaticResource CustomStyle}" />
answered Nov 7 at 12:53
mm8
79.1k81731
79.1k81731
Am not using custom window, I have set style in the window from which style get applied to all the controls defined inside the window
– Keerthana
Nov 8 at 6:20
1
@Keerthana: Please post your XAML to clarify your issue.
– mm8
Nov 8 at 8:10
posted the xaml code, also style gets applied when it is set directly to the control example: <Calendar thridParty="ThemeNew"/>
– Keerthana
Nov 8 at 8:44
add a comment |
Am not using custom window, I have set style in the window from which style get applied to all the controls defined inside the window
– Keerthana
Nov 8 at 6:20
1
@Keerthana: Please post your XAML to clarify your issue.
– mm8
Nov 8 at 8:10
posted the xaml code, also style gets applied when it is set directly to the control example: <Calendar thridParty="ThemeNew"/>
– Keerthana
Nov 8 at 8:44
Am not using custom window, I have set style in the window from which style get applied to all the controls defined inside the window
– Keerthana
Nov 8 at 6:20
Am not using custom window, I have set style in the window from which style get applied to all the controls defined inside the window
– Keerthana
Nov 8 at 6:20
1
1
@Keerthana: Please post your XAML to clarify your issue.
– mm8
Nov 8 at 8:10
@Keerthana: Please post your XAML to clarify your issue.
– mm8
Nov 8 at 8:10
posted the xaml code, also style gets applied when it is set directly to the control example: <Calendar thridParty="ThemeNew"/>
– Keerthana
Nov 8 at 8:44
posted the xaml code, also style gets applied when it is set directly to the control example: <Calendar thridParty="ThemeNew"/>
– Keerthana
Nov 8 at 8:44
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53186377%2fhow-to-load-my-style-file-instead-of-generic-xaml-while-applying-style-in-window%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
How did you "appy the style from another assembly in window for entire application"? Do the same for the custom control.
– mm8
Nov 7 at 12:51
I have my theme file in third party library. I included it's assembly in my project and setting style globally in window
– Keerthana
Nov 8 at 6:19