コード例 #1
0
 void OnLoaded()
 {
     if (VisualTreeExHelper.FindItemsPanel(AssociatedObject) is not UniformGrid uniformGrid)
     {
         throw new Exception($"ItemsPanel must be of type {nameof(UniformGrid)}");
     }
     this.uniformGrid = uniformGrid;
     AssociatedObject.PreviewKeyDown += AssociatedObject_PreviewKeyDown;
 }