Skip to content

fix #1140 "System.ArgumentNullException: 'Value cannot be null. Parameter name: defaultDestinationValue'" #1398

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
19 changes: 19 additions & 0 deletions Wpf.Ui.sln
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wpf.Ui.Demo.Dialogs", "samp
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wpf.Ui.DependencyInjection", "src\Wpf.Ui.DependencyInjection\Wpf.Ui.DependencyInjection.csproj", "{9C8D6133-9417-43A1-B54F-725009569D71}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wpf.Ui.Demo.SetResources.Simple", "samples\Wpf.Ui.Demo.SetResources.Simple\Wpf.Ui.Demo.SetResources.Simple.csproj", "{3B424CF4-09F8-47D3-8420-53D7A1165B9C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -353,6 +355,22 @@ Global
{9C8D6133-9417-43A1-B54F-725009569D71}.Release|x64.Build.0 = Release|Any CPU
{9C8D6133-9417-43A1-B54F-725009569D71}.Release|x86.ActiveCfg = Release|Any CPU
{9C8D6133-9417-43A1-B54F-725009569D71}.Release|x86.Build.0 = Release|Any CPU
{3B424CF4-09F8-47D3-8420-53D7A1165B9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3B424CF4-09F8-47D3-8420-53D7A1165B9C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3B424CF4-09F8-47D3-8420-53D7A1165B9C}.Debug|arm64.ActiveCfg = Debug|Any CPU
{3B424CF4-09F8-47D3-8420-53D7A1165B9C}.Debug|arm64.Build.0 = Debug|Any CPU
{3B424CF4-09F8-47D3-8420-53D7A1165B9C}.Debug|x64.ActiveCfg = Debug|Any CPU
{3B424CF4-09F8-47D3-8420-53D7A1165B9C}.Debug|x64.Build.0 = Debug|Any CPU
{3B424CF4-09F8-47D3-8420-53D7A1165B9C}.Debug|x86.ActiveCfg = Debug|Any CPU
{3B424CF4-09F8-47D3-8420-53D7A1165B9C}.Debug|x86.Build.0 = Debug|Any CPU
{3B424CF4-09F8-47D3-8420-53D7A1165B9C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3B424CF4-09F8-47D3-8420-53D7A1165B9C}.Release|Any CPU.Build.0 = Release|Any CPU
{3B424CF4-09F8-47D3-8420-53D7A1165B9C}.Release|arm64.ActiveCfg = Release|Any CPU
{3B424CF4-09F8-47D3-8420-53D7A1165B9C}.Release|arm64.Build.0 = Release|Any CPU
{3B424CF4-09F8-47D3-8420-53D7A1165B9C}.Release|x64.ActiveCfg = Release|Any CPU
{3B424CF4-09F8-47D3-8420-53D7A1165B9C}.Release|x64.Build.0 = Release|Any CPU
{3B424CF4-09F8-47D3-8420-53D7A1165B9C}.Release|x86.ActiveCfg = Release|Any CPU
{3B424CF4-09F8-47D3-8420-53D7A1165B9C}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -364,6 +382,7 @@ Global
{5138077E-670E-413D-94D1-0825B6D1201B} = {D7EA6A65-3CB5-4A59-934A-B8402C849107}
{E37CD05A-EBFC-429D-A550-BEE44119FA9E} = {D7EA6A65-3CB5-4A59-934A-B8402C849107}
{7F6C7E7A-A4B5-4D12-88EB-217CA59284F4} = {D7EA6A65-3CB5-4A59-934A-B8402C849107}
{3B424CF4-09F8-47D3-8420-53D7A1165B9C} = {D7EA6A65-3CB5-4A59-934A-B8402C849107}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {234CB3F9-5ADC-433F-BDBD-CB8EA59EB518}
Expand Down
7 changes: 7 additions & 0 deletions samples/Wpf.Ui.Demo.SetResources.Simple/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Application
x:Class="Wpf.Ui.Demo.SetResources.Simple.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
StartupUri="MainWindow.xaml">
</Application>
30 changes: 30 additions & 0 deletions samples/Wpf.Ui.Demo.SetResources.Simple/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
// All Rights Reserved.

using System.Windows;
using Wpf.Ui.Appearance;
using Wpf.Ui.Markup;

namespace Wpf.Ui.Demo.SetResources.Simple;

/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App
{
public static readonly ThemesDictionary ThemesDictionary = new();
public static readonly ControlsDictionary ControlsDictionary = new();

public static void Apply(ApplicationTheme theme)
{
ThemesDictionary.Theme = theme;
}

public static void ApplyTheme(FrameworkElement element)
{
element.Resources.MergedDictionaries.Add(ThemesDictionary);
element.Resources.MergedDictionaries.Add(ControlsDictionary);
}
}
11 changes: 11 additions & 0 deletions samples/Wpf.Ui.Demo.SetResources.Simple/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
// All Rights Reserved.

using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, // where theme specific resource dictionaries are located (used if a resource is not found in the page, or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly // where the generic resource dictionary is located (used if a resource is not found in the page, app, or any theme specific resource dictionaries)
)]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
107 changes: 107 additions & 0 deletions samples/Wpf.Ui.Demo.SetResources.Simple/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<ui:FluentWindow
x:Class="Wpf.Ui.Demo.SetResources.Simple.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:tray="http://schemas.lepo.co/wpfui/2022/xaml/tray"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
xmlns:pages="clr-namespace:Wpf.Ui.Demo.SetResources.Simple.Views.Pages"
Title="WPF UI - Simple Demo"
Width="1100"
Height="650"
d:DesignHeight="450"
d:DesignWidth="800"
ui:Design.Background="{DynamicResource ApplicationBackgroundBrush}"
ui:Design.Foreground="{DynamicResource TextFillColorPrimaryBrush}"
ExtendsContentIntoTitleBar="True"
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
WindowBackdropType="Mica"
WindowCornerPreference="Round"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">

<ui:FluentWindow.InputBindings>
<KeyBinding
Key="F"
Command="{Binding ElementName=AutoSuggestBox, Path=FocusCommand}"
Modifiers="Control" />
</ui:FluentWindow.InputBindings>

<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>

<ui:NavigationView x:Name="RootNavigation" Grid.Row="1">
<ui:NavigationView.AutoSuggestBox>
<ui:AutoSuggestBox x:Name="AutoSuggestBox" PlaceholderText="Search">
<ui:AutoSuggestBox.Icon>
<ui:IconSourceElement>
<ui:SymbolIconSource Symbol="Search24" />
</ui:IconSourceElement>
</ui:AutoSuggestBox.Icon>
</ui:AutoSuggestBox>
</ui:NavigationView.AutoSuggestBox>
<ui:NavigationView.Header>
<ui:BreadcrumbBar
Margin="42,32,0,0"
FontSize="28"
FontWeight="DemiBold" />
</ui:NavigationView.Header>
<ui:NavigationView.MenuItems>
<ui:NavigationViewItem
Content="Dashboard"
NavigationCacheMode="Enabled"
TargetPageType="{x:Type pages:DashboardPage}">
<ui:NavigationViewItem.Icon>
<ui:SymbolIcon Symbol="Home24" />
</ui:NavigationViewItem.Icon>
</ui:NavigationViewItem>
<ui:NavigationViewItem
Content="Data"
NavigationCacheMode="Enabled"
TargetPageType="{x:Type pages:DataPage}">
<ui:NavigationViewItem.Icon>
<ui:SymbolIcon Symbol="DataHistogram24" />
</ui:NavigationViewItem.Icon>
</ui:NavigationViewItem>
<ui:NavigationViewItem
Content="Expanders"
NavigationCacheMode="Enabled"
TargetPageType="{x:Type pages:ExpanderPage}">
<ui:NavigationViewItem.Icon>
<ui:SymbolIcon Symbol="ExpandUpLeft24" />
</ui:NavigationViewItem.Icon>
</ui:NavigationViewItem>
</ui:NavigationView.MenuItems>
<ui:NavigationView.FooterMenuItems>
<ui:NavigationViewItem
Content="Settings"
NavigationCacheMode="Disabled"
TargetPageType="{x:Type pages:SettingsPage}">
<ui:NavigationViewItem.Icon>
<ui:SymbolIcon Symbol="Settings24" />
</ui:NavigationViewItem.Icon>
</ui:NavigationViewItem>
</ui:NavigationView.FooterMenuItems>
</ui:NavigationView>

<ui:TitleBar
Title="WPF UI - Simple Demo"
Grid.Row="0"
Icon="pack://application:,,,/Assets/applicationIcon-256.png" />

<tray:NotifyIcon
Grid.Row="0"
FocusOnLeftClick="True"
Icon="pack://application:,,,/Assets/applicationIcon-256.png"
MenuOnRightClick="True"
TooltipText="Wpf.Ui.Demo.Simple">
<tray:NotifyIcon.Menu>
<ContextMenu ItemsSource="{Binding ViewModel.TrayMenuItems, Mode=OneWay}" />
</tray:NotifyIcon.Menu>
</tray:NotifyIcon>
</Grid>
</ui:FluentWindow>
28 changes: 28 additions & 0 deletions samples/Wpf.Ui.Demo.SetResources.Simple/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
// All Rights Reserved.

using Wpf.Ui.Appearance;
using Wpf.Ui.Controls;
using Wpf.Ui.Demo.SetResources.Simple.Views.Pages;
using Wpf.Ui.Markup;

namespace Wpf.Ui.Demo.SetResources.Simple;

/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow
{
public MainWindow()
{
DataContext = this;

App.ApplyTheme(this);

InitializeComponent();

Loaded += (_, _) => RootNavigation.Navigate(typeof(DashboardPage));
}
}
13 changes: 13 additions & 0 deletions samples/Wpf.Ui.Demo.SetResources.Simple/Models/DataColor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
// All Rights Reserved.

using System.Windows.Media;

namespace Wpf.Ui.Demo.SetResources.Simple.Models;

public struct DataColor
{
public Brush Color { get; set; }
}
20 changes: 20 additions & 0 deletions samples/Wpf.Ui.Demo.SetResources.Simple/Models/DataGroup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
// All Rights Reserved.

namespace Wpf.Ui.Demo.SetResources.Simple.Models;

public class DataGroup
{
public DataGroup(bool selected, string name, string groupName)
{
Selected = selected;
Name = name;
GroupName = groupName;
}

public bool Selected { get; set; }
public string Name { get; set; }
public string GroupName { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<Page
x:Class="Wpf.Ui.Demo.SetResources.Simple.Views.Pages.DashboardPage"
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:ui="http://schemas.lepo.co/wpfui/2022/xaml"
Title="DashboardPage"
d:DesignHeight="450"
d:DesignWidth="800"
ui:Design.Background="{DynamicResource ApplicationBackgroundBrush}"
ui:Design.Foreground="{DynamicResource TextFillColorPrimaryBrush}"
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
mc:Ignorable="d">

<Grid Margin="42" VerticalAlignment="Top">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>

<ui:Button
Grid.Column="0"
Click="OnBaseButtonClick"
Content="Click me!"
Icon="{ui:SymbolIcon Fluent24}" />
<TextBlock
x:Name="CounterTextBlock"
Grid.Column="1"
Margin="12,0,0,0"
VerticalAlignment="Center" />
</Grid>
</Page>
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
// All Rights Reserved.

using System.Windows;

namespace Wpf.Ui.Demo.SetResources.Simple.Views.Pages;

/// <summary>
/// Interaction logic for DashboardPage.xaml
/// </summary>
public partial class DashboardPage
{
private int _counter = 0;

public DashboardPage()
{
App.ApplyTheme(this);

DataContext = this;
InitializeComponent();

CounterTextBlock.SetCurrentValue(System.Windows.Controls.TextBlock.TextProperty, _counter.ToString());
}

private void OnBaseButtonClick(object sender, RoutedEventArgs e)
{
CounterTextBlock.SetCurrentValue(
System.Windows.Controls.TextBlock.TextProperty,
(++_counter).ToString()
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<Page
x:Class="Wpf.Ui.Demo.SetResources.Simple.Views.Pages.DataPage"
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:ui="http://schemas.lepo.co/wpfui/2022/xaml"
xmlns:models="clr-namespace:Wpf.Ui.Demo.SetResources.Simple.Models"
Title="DataPage"
d:DesignHeight="450"
d:DesignWidth="800"
ui:Design.Background="{DynamicResource ApplicationBackgroundBrush}"
ui:Design.Foreground="{DynamicResource TextFillColorPrimaryBrush}"
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
ScrollViewer.CanContentScroll="False"
mc:Ignorable="d">

<Grid Margin="42">
<ui:VirtualizingItemsControl
x:Name="ColorsItemsControl"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
VirtualizingPanel.CacheLengthUnit="Item">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type models:DataColor}">
<ui:Button
Width="80"
Height="80"
Margin="2"
Padding="0"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Appearance="Secondary"
Background="{Binding Color, Mode=OneWay}"
FontSize="25"
Icon="Fluent24" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ui:VirtualizingItemsControl>
</Grid>
</Page>
Loading