Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions iNKORE.UI.WPF.Modern.sln
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SettingsNavigationTest", "s
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ButtonsOnTitlebar", "samples\ButtonsOnTitlebar\ButtonsOnTitlebar.csproj", "{B7A35355-ED5B-494C-9BB8-6EBA1155E60E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TabControlTest", "samples\TabControlTest\TabControlTest.csproj", "{103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -395,26 +393,6 @@ Global
{B7A35355-ED5B-494C-9BB8-6EBA1155E60E}.Release|x64.Build.0 = Release|Any CPU
{B7A35355-ED5B-494C-9BB8-6EBA1155E60E}.Release|x86.ActiveCfg = Release|Any CPU
{B7A35355-ED5B-494C-9BB8-6EBA1155E60E}.Release|x86.Build.0 = Release|Any CPU
{103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Debug|ARM.ActiveCfg = Debug|Any CPU
{103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Debug|ARM.Build.0 = Debug|Any CPU
{103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Debug|ARM64.Build.0 = Debug|Any CPU
{103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Debug|x64.ActiveCfg = Debug|Any CPU
{103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Debug|x64.Build.0 = Debug|Any CPU
{103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Debug|x86.ActiveCfg = Debug|Any CPU
{103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Debug|x86.Build.0 = Debug|Any CPU
{103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Release|Any CPU.Build.0 = Release|Any CPU
{103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Release|ARM.ActiveCfg = Release|Any CPU
{103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Release|ARM.Build.0 = Release|Any CPU
{103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Release|ARM64.ActiveCfg = Release|Any CPU
{103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Release|ARM64.Build.0 = Release|Any CPU
{103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Release|x64.ActiveCfg = Release|Any CPU
{103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Release|x64.Build.0 = Release|Any CPU
{103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Release|x86.ActiveCfg = Release|Any CPU
{103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -435,7 +413,6 @@ Global
{84C80EA6-0F9C-49CF-AB66-5696CC888CA7} = {A96F98E9-18B5-4863-8F28-9B7BDF70A128}
{AF682B4E-6A51-474A-8D80-0738A94C72FA} = {A96F98E9-18B5-4863-8F28-9B7BDF70A128}
{B7A35355-ED5B-494C-9BB8-6EBA1155E60E} = {A96F98E9-18B5-4863-8F28-9B7BDF70A128}
{103A71A3-95FD-60C8-2D1F-3AA459BD0DDB} = {A96F98E9-18B5-4863-8F28-9B7BDF70A128}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6251E140-0FAA-4DE9-B245-1C5BE188E578}
Expand Down
15 changes: 0 additions & 15 deletions samples/TabControlTest/App.xaml

This file was deleted.

13 changes: 0 additions & 13 deletions samples/TabControlTest/App.xaml.cs

This file was deleted.

10 changes: 0 additions & 10 deletions samples/TabControlTest/AssemblyInfo.cs

This file was deleted.

13 changes: 0 additions & 13 deletions samples/TabControlTest/MainWindow.xaml

This file was deleted.

58 changes: 0 additions & 58 deletions samples/TabControlTest/MainWindow.xaml.cs

This file was deleted.

14 changes: 0 additions & 14 deletions samples/TabControlTest/TabControlTest.csproj

This file was deleted.

37 changes: 16 additions & 21 deletions samples/WpfApp1/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,21 @@
ui:WindowHelper.UseModernWindowStyle="True"
Loaded="Window_Loaded" Background="{DynamicResource {x:Static ui:ThemeKeys.AcrylicBackgroundFillColorDefaultBrushKey}}">
<Canvas>

<ui:ScrollViewerEx Height="198" Width="229" Canvas.Left="50" Canvas.Top="34" VerticalScrollBarVisibility="Hidden" HorizontalAlignment="Left" VerticalAlignment="Top">
<Button x:Name="Button_MessageBox" Click="Button_MessageBox_Click" Height="1000">
<ui:IconAndText Icon="{x:Static ui:SegoeFluentIcons.Message}" Content="MessageBox Test"/>
</Button>
</ui:ScrollViewerEx>
<ui:ScrollViewerEx Height="198" Width="229" Canvas.Left="367" Canvas.Top="34" VerticalScrollBarVisibility="Visible" HorizontalAlignment="Left" VerticalAlignment="Center">
<Button x:Name="Button_MessageBox1" Click="Button_MessageBox_Click" Height="1000">
<ui:IconAndText Icon="{x:Static ui:SegoeFluentIcons.Message}" Content="MessageBox Test"/>
</Button>
</ui:ScrollViewerEx>
<ui:ScrollViewerEx Height="198" Width="229" Canvas.Left="51" Canvas.Top="253" VerticalScrollBarVisibility="Disabled" HorizontalAlignment="Left" VerticalAlignment="Top">
<Button x:Name="Button_MessageBox2" Click="Button_MessageBox_Click" Height="1000">
<ui:IconAndText Icon="{x:Static ui:SegoeFluentIcons.Message}" Content="MessageBox Test"/>
</Button>
</ui:ScrollViewerEx>
<ui:ScrollViewerEx Height="198" Width="229" Canvas.Left="368" Canvas.Top="256" VerticalScrollBarVisibility="Hidden" HorizontalAlignment="Left" VerticalAlignment="Top">
<Button x:Name="Button_MessageBox3" Click="Button_MessageBox_Click" Height="40">
<ui:IconAndText Icon="{x:Static ui:SegoeFluentIcons.Message}" Content="MessageBox Test"/>
</Button>
</ui:ScrollViewerEx>
<ikw:SimpleStackPanel Height="259" Width="678">
<Expander Style="{StaticResource {x:Static ui:ThemeKeys.ExpanderCardStyleKey}}" Header="Welcome">
<Expander.Content>
<Grid HorizontalAlignment="Stretch" Background="Red">
<TextBlock HorizontalAlignment="Right">Test</TextBlock>
</Grid>
</Expander.Content>
</Expander>
<Expander Style="{StaticResource {x:Static ui:ThemeKeys.ExpanderCardStyleKey}}" Header="Welcome" HorizontalAlignment="Stretch">
<Expander.Content>
<Grid HorizontalAlignment="Stretch" Background="Red">
<TextBlock HorizontalAlignment="Right">Test</TextBlock>
</Grid>
</Expander.Content>
</Expander>
</ikw:SimpleStackPanel>
</Canvas>
</Window>
2 changes: 1 addition & 1 deletion samples/WpfApp1/WpfApp1.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\source\Inkore.UI.WPF.Modern.Controls\iNKORE.UI.WPF.Modern.Controls.csproj" />
<ProjectReference Include="..\..\source\iNKORE.UI.WPF.Modern.Controls\iNKORE.UI.WPF.Modern.Controls.csproj" />
<ProjectReference Include="..\..\source\Inkore.UI.WPF.Modern\iNKORE.UI.WPF.Modern.csproj" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
Simply handle the event and set <Bold>e.Cancel = true</Bold> to keep the tab open.
</TextBlock>

<TabControl x:Name="tabControl6" MinHeight="160">
<TabControl x:Name="tabControl6" MinHeight="160" ui:TabControlHelper.TabItemClosing="tabControl6_TabItemClosing">
<TabItem x:Name="TabItem_Example6_Tab1" Header="Closable">
<TextBlock TextWrapping="Wrap" Margin="12">
This tab demonstrates the default close behavior. When the close button is clicked, the tab closes immediately
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,29 +87,6 @@ private void RadioButtons_SelectionChanged(object sender, SelectionChangedEventA
private void InitializeExample6()
{
ResetExample6Tabs();

tabControl.RegisterTabClosingEvent((menuControl, e) =>
{
if (e.Tab.Tag is "ConfirmClose")
{
var msgResult = MessageBox.Show("Do you want to close this tab?", "Confirm", MessageBoxButton.OKCancel, MessageBoxImage.Question);
if (msgResult != MessageBoxResult.OK)
{
e.Cancel = true;
return;
}
}
else if (e.Tab.Tag is "NiceTry")
{
e.Cancel = true;

if ((e.Tab.Header as string) != NiceTry)
e.Tab.Header = NiceTry;
else e.Tab.Header = "You can't close me!";

return;
}
});
}

private void ResetExample6Tabs()
Expand Down Expand Up @@ -243,45 +220,64 @@ public void UpdateExampleCode()
";

public string Example6Xaml => $@"
<TabControl x:Name=""tabControl6"">
<TabControl x:Name=""tabControl6"" ui:TabControlHelper.TabItemClosing=""tabControl6_TabItemClosing"">
<TabItem x:Name=""TabItem_Example6_Tab1"" Header=""Closable""/>
<TabItem x:Name=""TabItem_Example6_Tab2"" Header=""Confirm To Close"" Tag=""ConfirmClose""/>
<TabItem x:Name=""TabItem_Example6_Tab3"" Header=""DON'T TOUCH ME!"" Tag=""NiceTry""/>
</TabControl>
";

public string Example6CS => $@"
// Invoked during the constructor after InitializeComponent or at any later time
private void InitializeExample6()
private void tabControl6_TabItemClosing(object sender, TabViewTabCloseRequestedEventArgs e)
{{
ResetExample6Tabs();

tabControl.RegisterTabClosingEvent((menuControl, e) =>
if (e.Tab.Tag is ""ConfirmClose"")
{{
if (e.Tab.Tag is ""ConfirmClose"")
{{
var msgResult = MessageBox.Show(""Do you want to close this tab?"", ""Confirm"", MessageBoxButton.OKCancel, MessageBoxImage.Question);
if (msgResult != MessageBoxResult.OK)
{{
e.Cancel = true;
return;
}}
}}
else if (e.Tab.Tag is ""NiceTry"")
var msgResult = MessageBox.Show(""Do you want to close this tab?"", ""Confirm"", MessageBoxButton.OKCancel, MessageBoxImage.Question);
if (msgResult != MessageBoxResult.OK)
{{
e.Cancel = true;

if ((e.Tab.Header as string) != NiceTry)
e.Tab.Header = NiceTry;
else e.Tab.Header = ""You can't close me!"";

return;
}}
}});
}}
else if (e.Tab.Tag is ""NiceTry"")
{{
e.Cancel = true;

if ((e.Tab.Header as string) != NiceTry)
e.Tab.Header = NiceTry;
else e.Tab.Header = ""You can't close me!"";

return;
}}

}}
";


#endregion

private void tabControl6_TabItemClosing(object sender, TabViewTabCloseRequestedEventArgs e)
{
if (e.Tab.Tag is "ConfirmClose")
{
var msgResult = MessageBox.Show("Do you want to close this tab?", "Confirm", MessageBoxButton.OKCancel, MessageBoxImage.Question);
if (msgResult != MessageBoxResult.OK)
{
e.Cancel = true;
return;
}
}
else if (e.Tab.Tag is "NiceTry")
{
e.Cancel = true;

if ((e.Tab.Header as string) != NiceTry)
e.Tab.Header = NiceTry;
else e.Tab.Header = "You can't close me!";
Comment on lines +274 to +276

Copilot AI Nov 18, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both branches of this 'if' statement write to the same variable - consider using '?' to express intent better.

Suggested change
if ((e.Tab.Header as string) != NiceTry)
e.Tab.Header = NiceTry;
else e.Tab.Header = "You can't close me!";
e.Tab.Header = ((e.Tab.Header as string) != NiceTry) ? NiceTry : "You can't close me!";

Copilot uses AI. Check for mistakes.

return;
}

}
}
}
Loading
Loading