iNKORE-NET / UI.WPF.Modern

Modern (Fluent 2) styles and controls for your WPF applications
https://docs.inkore.net/ui-wpf-modern
GNU Lesser General Public License v2.1
326 stars 29 forks source link

FontFamily Null refrence exception and NavigationView CornerRadius null refrence #24

Closed ghost1372 closed 7 months ago

ghost1372 commented 7 months ago

Create a Blank WPF app Add nuget package Add Resources in MainWindow (not app.xaml)

<Window.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ui:ThemeResources />
            <ui:XamlControlsResources />
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Window.Resources>

and try add ComboBox or any controls which is using IconElement

<ComboBox/>

and you will get exception

image

also i get exception here:

private static void OnFontFamilyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
    var fontIcon = (FontIcon)d;
    if (fontIcon._textBlock != null)
    {
        fontIcon._textBlock.FontFamily = (FontFamily)e.NewValue;
    }
}

can you fix this?


Update:

also when i want to use NavigationView i get null refrence exception for Cornerradius: removing this line from NavigationView.xaml file can fix this issue:

CornerRadius="{Binding Value, Source={StaticResource OverlayCornerRadiusProxy}, Converter={StaticResource RightCornerRadiusFilterConverter}}"

NotYoojun commented 7 months ago

I will check this later, I'm on break right now.

ghost1372 commented 7 months ago

i changed (FontFamily)Application.Current.Resources["SymbolThemeFontFamily"] with new FontFamily("Segoe MDL2 Assets")

and issue can be fixed

NotYoojun commented 7 months ago

What about changing it to (FontFamily)Application.Current.FindResource("SymbolThemeFontFamily"), does that work? I'm not with my computer so I can't test it out right now.

ghost1372 commented 7 months ago

(FontFamily)Application.Current.FindResource("SymbolThemeFontFamily")

not worked, i think this is related #25

NotYoojun commented 7 months ago

OK, let's talk about it in #25