Comments (16)
For scenarios like this, where there's an unwritten rule about naming conventions, I like to create a test (or tests) to ensure any future changes follow the rule too.
How do others feel about this?
Such a test would iterate over all XAML files in the project and fail if any of the defined u:Id
or x:Name
values do not have the correct casing pattern.
Would such a test be appropriate in the 'CalculatorUnitTests' project or should it go somewhere else?
from calculator.
Any and all occurrences of x:Name
should use Pascal-case. Right now, it is inconsistent between views. The reasoning is that x:Name
converts the object to be accessible as a property of the current view and properties should be Pascal-cased. I think this issue is easily fixed with a regex + replace.
from calculator.
from calculator.
@jlaanstra has a good point. It's unfortunate that we wasted Lance's time making that change. @LanceMcCarthy, I apologize for that. We should revert the changes to the resw and focus on only updating the x:Names.
from calculator.
This is your friendly Microsoft Issue Bot. I created this issue automatically as requested by a team member.
from calculator.
Can I get clarification on which views are to be updated?
My understanding of the request is the x:Name
and x:Uid
of XAML-defined UIElement
should use Pascal casing:
Ex.
<TextBlock x:Name="firstNameTextBox" />
Should be
<TextBlock x:Name="FirstNameTextBox" />
from calculator.
x:Uid
I am less concerned with, although following the same convention feels appropriate. This would require updating the values in the resw files. Also accomplishable with Replace.
from calculator.
Okay, I can take this one
PS - I'm avoiding modifying C++ as much as possible if you couldn't tell already :)
from calculator.
That's fine, there is a lot of impactful work that can be done in just XAML. I do enjoy discussing C++, however, and I'm happy to recommend learning resources ranging across different levels of experience :)
from calculator.
IMO, leveraging unit tests to enforce a style/naming convention feels a bit unorthodox. XAML Styler is used to enforce other rules in XAML files in the project; perhaps this is a useful feature for the that tool?
from calculator.
FYI - This cannot be solved with a simple regex and replace all. There are a ton of visual state triggers and style setters that will get erroneously overwritten.
It's a case of one at a time Find and Replace, taking care not to accidentally change AutomationIDs and Uids before those tasks are directly approached.
I'm about 1/2 way through the views now.
If you do know of a regex that works in VS2017 for matching: {x:Name"}{[A-Z\s+]}{[a-z0-9]*}
to stop at camel-casing names, that would save me a little time, but not much. It's easy to click past x:Name=
matches that are properly cased.
from calculator.
Hey Lance, this regex will find x:Name
s that are camel-cased: x:Name="[a-z]
Or were you looking for something different?
from calculator.
That was my first try, but the quotes were messing with the regex-Find, when I removed it, I got no results. I figured it just me messing up the expression.
I'll try it again, but use Resharper for C++.
from calculator.
It looks like when we went from private to public, something was broken with my private copy of the repo (it was forked a while before this went public). It removed linked commits, preventing me from opening a Pull Request and automatically unassigned me from this task.
To fix this, I had to re-fork the public repo and copy over my fixes to the latest master branch.
Unfortunately, this means all the work is going to be inside a single commit. However, this also allowed me to manually check for conflicts before pushing the commit.
from calculator.
Opened #244
from calculator.
Are we sure we want to change all x:Uid keys? How will the loc system handles this?
from calculator.
Related Issues (20)
- How to remove fucking spaces from this calculator or return to windows 7 verison. HOT 2
- space
- Wrong result in the win 11 calculator HOT 2
- Calculator Does Not Support Multiplying By Negative Numbers
- Using '%' in Standard Calculator Clears Input HOT 1
- Multiple Currency Conversion
- Calculator crashes if you zoom to far out on the Graphing Page
- Ja
- Ja
- [Localization]
- SWIPE DELETE FUNCTION FREEZES APP
- Wrong icon of calculator
- Disable scientific notation
- Programmer calculator treats MSB as sign bit, no option to remove sign bit
- Can you set a button for the top function in all (scientific) modes
- Is it possible to add an option that allows you to restore the history even after closing the application and opening it again? HOT 1
- "about equal to" feature in the volume calculator/converter
- Constant ratio of units on the axes
- [Localization] [zh-CN] Incorrect translations in Currency
- Disabling the Clipboard User Service causes Calculator to crash when copying values or pressing CTRL+C
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from calculator.