HandyOrg / HandyOrg/HandyControl
Change SizeToContent in OnLoaded or OnSourceInitialized has no effect
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 7.2k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
hc:Window的继承类,如果在XAML中设定了SizeToContent="WidthAndHeight",在OnLoaded或者 OnSourceInitialized 里面修改SizeToContent为Manual会无效,窗口还是会自动变化。
会导致在OnLoaded、OnSourceInitialized 之后SizeToContent更新一次,使得在这两个方法中设置的SizeToContent和窗口Width、Height被覆盖。
解决办法
在XAML中去掉SizeToContent属性设置,或者修改为非WidthAndHeight的值。
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/Shared/HandyControl_Shared/Controls/Window/Window.cs around line 313 and review how SizeToContent is updated during window initialization. Reproduce the issue with SizeToContent="WidthAndHeight" and changes in OnLoaded or OnSourceInitialized. Done means those lifecycle changes are no longer overwritten and the window keeps the intended manual size.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100