Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我对 XAML / WPF 编程相当陌生。我想问如何将特定行的代码从 XAML 转换为 C#?
XAML:
<GridView> <ItemsPanelTemplate> <WrapGrid Orientation="Horizontal"/> </ItemsPanelTemplate> </GridView>
我怎样才能在 C# 中做到这一点?
如果你给控件起一个名字,像这样:
<GridView> <ItemsPanelTemplate> <WrapGrid Name="MyWrapGrid" Orientation="Horizontal"/> </ItemsPanelTemplate> </GridView>
您可以在 (C#) 后面的代码中执行此操作以更改方向:
MyWrapGrid.Orientation = Orientation.Horizontal;