Repository navigation
fix: 修复自定义主页 MyCard 使用 Inlines 后无法折叠 - #9305
Open
TomorrowX6 wants to merge 2 commits into
Open
TomorrowX6 wants to merge 2 commits into
TomorrowX6 wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
修改内容
修复自定义主页中的
MyCard在使用Inlines自定义标题后无法正常折叠的问题。将
MainTextBlock的创建逻辑提取为InitMainTextBlock:Inlines只初始化标题TextBlock,不再提前触发完整的MyCard.Init();MyCard仍在Loaded阶段执行完整初始化;MainTextBlock属性原有的初始化行为,不影响现有调用。问题原因
MyCard.Inlines原先通过MainTextBlock.Inlines获取集合,而MainTextBlock的 Getter 会调用Init()。自定义主页解析 XAML 时,读取
MyCard.Inlines的阶段正文控件尚未加入Children,导致:Children.Count只有 3;SwapControl无法保存正文控件;IsLoad被提前设置为True;Loaded事件直接返回;本 PR 使
Inlines只初始化标题控件,避免在 XAML 内容完成加载前提前执行完整初始化。验证
MyCard可正常折叠/展开MyCard.Inlines后可正常折叠/展开IsSwapped="True"时可正确默认折叠IsSwapped="False"时可正确默认展开CanSwap="False"时行为不变git diff --check通过Fixes #9162