Skip to content

Commit

Permalink
Merge branch 'singhashish-wpf:master' into textBoxTest
Browse files Browse the repository at this point in the history
  • Loading branch information
HarshitaMohite15 authored Jan 25, 2024
2 parents 3a76ba3 + 508099a commit 3f4d505
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 31 deletions.
3 changes: 1 addition & 2 deletions Win11ThemeSampleApp/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
<ResourceDictionary>

<ResourceDictionary.MergedDictionaries>
<ThemesDictionary Theme="Light"/>
<ThemesDictionary Theme="Dark"/>
<ControlsDictionary />

</ResourceDictionary.MergedDictionaries>

</ResourceDictionary>
Expand Down
43 changes: 26 additions & 17 deletions Win11ThemeSampleApp/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<Window x:Class="Win11ThemeSampleApp.MainWindow"
<FluentWindow x:Class="Win11ThemeSampleApp.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:Win11ThemeSampleApp" xmlns:wpf="http://schemas.microsoft.com/netfx/2007/xaml/presentation"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
Title="MainWindow" Height="450" Width="800"
WindowBackdropType="None"
WindowCornerPreference="Round">

<Grid>
<TitleBar Title="Sample WPF Application" />
<PassiveScrollViewer>
<StackPanel Orientation="Vertical">
<Button Content="Click Me">
Expand All @@ -18,6 +21,8 @@
<ToolTip Content="Hello World"/>
</Button.ToolTip>
</Button>
<Calendar ></Calendar>

<Button Content="FontIcon Button">
<Button.Icon>
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE7BA;"/>
Expand All @@ -39,24 +44,26 @@
</Button>
<StackPanel>
<RadioButton
Content="Option 1"
Content="Light"
FlowDirection="LeftToRight"
GroupName="radio_group_two"
IsChecked="True" />
IsChecked="True"
Checked="ToggleButton_Click" />
<RadioButton
Content="Option 2"
Content="Dark"
FlowDirection="LeftToRight"
GroupName="radio_group_two" />
<RadioButton
Content="Option 3"
GroupName="radio_group_two" Checked="ToggleButton_Click"/>
<RadioButton
Content="HighContrast"
FlowDirection="LeftToRight"
GroupName="radio_group_two" />
</StackPanel>
GroupName="radio_group_two" Checked="ToggleButton_Click"/>
</StackPanel>
<TextBox PlaceholderText="Enter some Text" IconPlacement="Right">
<TextBox.Icon>
<SymbolIcon Symbol="Search24"/>
</TextBox.Icon>
</TextBox>

<ComboBox MinWidth="200" HorizontalAlignment="Left" SelectedIndex="0">
<ComboBoxItem Content="Blue" />
<ComboBoxItem Content="Green" />
Expand All @@ -66,13 +73,15 @@
<TextBlock Name="abc">Standard Text Block for larger texts.</TextBlock>
<CheckBox Content="Test Checkbox"/>
<CheckBox IsThreeState="True" Content="Tri-State Checkbox"/>
<Calendar ></Calendar>
<Expander Header="Hey there I am an expander" />
<Slider />
<ProgressBar Value="35"/>
<ProgressBar IsIndeterminate="True"/>
<Expander Header="Hey there I am an expander" Content="Hey there I am the content inside the Expander"/>
<Slider Height="10"/>
<TextBlock Text="Progress Bar" />
<ProgressBar Value="35" Height="10"/>

<TextBlock Text="Inderminate Progress Bar" />
<ProgressBar IsIndeterminate="True" Height="10"/>

<ListBox>
<ListBox Width="500">
<ListBoxItem>WWE</ListBoxItem>
<ListBoxItem>Windows</ListBoxItem>
<ListBoxItem>MXP</ListBoxItem>
Expand Down Expand Up @@ -140,4 +149,4 @@
</StackPanel>
</PassiveScrollViewer>
</Grid>
</Window>
</FluentWindow>
28 changes: 16 additions & 12 deletions Win11ThemeSampleApp/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,30 @@ namespace Win11ThemeSampleApp
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
public partial class MainWindow : FluentWindow
{
public MainWindow()
{
InitializeComponent();
SetupDatagrid();
SystemThemeWatcher.Watch(this);
}

private void ToggleButton_Click(object sender, RoutedEventArgs e)
{
ApplicationTheme theme = ApplicationThemeManager.GetAppTheme();
if (theme == ApplicationTheme.Light)
{
ApplicationThemeManager.Apply(ApplicationTheme.Dark);
}
else
{
ApplicationThemeManager.Apply(ApplicationTheme.Light);
}

//String themeName = (sender as RadioButton).Content as string;
//switch (themeName)
//{
// case "Light":
// ApplicationThemeManager.Apply(ApplicationTheme.Light);
// break;
// case "Dark":
// ApplicationThemeManager.Apply(ApplicationTheme.Dark);
// break;
// case "HighContrast":
// ApplicationThemeManager.Apply(ApplicationTheme.HighContrast);
// break;
//}
}

private void SetupDatagrid()
Expand All @@ -48,7 +52,7 @@ private void SetupDatagrid()
}
}

internal class User
public class User
{
public int Id { get; set; }
public string Name { get; set; }
Expand Down

0 comments on commit 3f4d505

Please sign in to comment.