コード例 #1
0
 private void CreateMirrors()
 {
     for (int i = 0; i < _model.Mirrors.Count; i++)
     {
         Mirror     mirror     = _model.Mirrors[i];
         MirrorView mirrorView = new MirrorView();
         mirrorView.HorizontalAlignment = HorizontalAlignment.Left;
         mirrorView.VerticalAlignment   = VerticalAlignment.Top;
         mirrorView.Width  = BlackboxConfig.BoxWidth;
         mirrorView.Height = BlackboxConfig.BoxHeight;
         mirrorView.Margin =
             new Thickness(mirror.Position.Row * BlackboxConfig.BoxWidth,
                           mirror.Position.Column * BlackboxConfig.BoxHeight, 0, 0);
         mirrorView.DataContext = mirror;
         Binding binding = new Binding();
         binding.Source = mirror;
         binding.Path   = new PropertyPath("Guessed");
         binding.Mode   = BindingMode.OneWay;
         mirrorView.SetBinding(MirrorView.StateValueProperty, binding);
         this._mirrors.Add(mirrorView);
         this.LayoutRoot.Children.Add(mirrorView);
     }
 }
コード例 #2
0
 private void CreateMirrors()
 {
     for (int i = 0; i < _model.Mirrors.Count; i++)
     {
         Mirror mirror = _model.Mirrors[i];
         MirrorView mirrorView = new MirrorView();
         mirrorView.HorizontalAlignment = HorizontalAlignment.Left;
         mirrorView.VerticalAlignment = VerticalAlignment.Top;
         mirrorView.Width = BlackboxConfig.BoxWidth;
         mirrorView.Height = BlackboxConfig.BoxHeight;
         mirrorView.Margin =
             new Thickness(mirror.Position.Row * BlackboxConfig.BoxWidth,
                 mirror.Position.Column * BlackboxConfig.BoxHeight, 0, 0);
         mirrorView.DataContext = mirror;
         Binding binding = new Binding();
         binding.Source = mirror;
         binding.Path = new PropertyPath("Guessed");
         binding.Mode = BindingMode.OneWay;
         mirrorView.SetBinding(MirrorView.StateValueProperty, binding);
         this._mirrors.Add(mirrorView);
         this.LayoutRoot.Children.Add(mirrorView);
     }
 }