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
332 stars 29 forks source link

Crashes on TabView #2

Closed pp111 closed 1 year ago

pp111 commented 1 year ago

Hi,

On the SampleApp clicking on Navigation|TabView crashes the application with an exception on Inkore.UI.WPF.Modern.Controls.Primitives.UpdateTabGeometry

It looks like a problem with the double values being converted to string. Depending on the system locale the decimal is represented as "," instead of a "." and this causes issues in the Geometry

Changing var data = $"F1 M0,{height - 1f / scaleFactor} a 4,4 0 0 0 4,-4 L 4,{leftCorner} a {leftCorner},{leftCorner} 0 0 1 {leftCorner},-{leftCorner} l {tabItem.ActualWidth - (leftCorner + rightCorner + 1.0f / scaleFactor)},0 a {rightCorner},{rightCorner} 0 0 1 {rightCorner},{rightCorner} l 0,{height - (4 + rightCorner + 1.0f / scaleFactor)} a 4,4 0 0 0 4,4 Z";

to

var data = $"F1 M0,{Math.Round(height - 1f / scaleFactor)} a 4,4 0 0 0 4,-4 L 4,{leftCorner} a {leftCorner},{leftCorner} 0 0 1 {leftCorner},-{leftCorner} l {Math.Round(tabItem.ActualWidth - (leftCorner + rightCorner + 1.0f / scaleFactor))},0 a {rightCorner},{rightCorner} 0 0 1 {rightCorner},{rightCorner} l 0,{Math.Round(height - (4 + rightCorner + 1.0f / scaleFactor))} a 4,4 0 0 0 4,4 Z";

Fixes the issue

NotYoojun commented 1 year ago

Hi! Thanks for reporting this. I've already committed the code just now. And it will be available in the next release(or you can compile a clone right now) :)