Beispiel #1
0
        protected override void InitializeComponents()
        {
            Border border = new Border();

            border.Background = new SolidColorBrush(new ColorW(0, 0, 0, 128));
            this.Content      = border;

            StackPanel panel = new StackPanel();

            panel.Orientation = Orientation.Horizontal;
            border.Child      = panel;

            Border blank = new Border();

            blank.SetBinding(Border.VisibilityProperty, new Binding(IsShortModeProperty)
            {
                Source = this, Converter = UIHelper.CreateConverter((bool o) => o ? Visibility.Visible : Visibility.Collapsed)
            });
            blank.SetBinding(Border.WidthProperty, new Binding(PaddingLeftProperty)
            {
                Source = this
            });
            blank.SetBinding(Border.HeightProperty, new Binding(HeightProperty)
            {
                Source = this
            });
            panel.Children.Add(blank);

            TextBlock textBlock = new TextBlock();

            textBlock.Foreground          = Brushes.Cyan;
            textBlock.Margin              = new Thickness(6, 0, 0, 0);
            textBlock.HorizontalAlignment = HorizontalAlignment.Left;
            textBlock.VerticalAlignment   = VerticalAlignment.Center;

            textBlock.SetBinding(TextBlock.TextProperty, new Binding(TextProperty)
            {
                Source = this
            });
            panel.Children.Add(textBlock);

            this.Height           = 16;
            this.IsHitTestVisible = false;
            base.InitializeComponents();
        }
Beispiel #2
0
        private void InitializeComponents()
        {
            Style style = RootStyle.CreateRootStyle();

            style.TargetType = this.GetType();
            this.Style       = style;

            this.Background = null;

            var minimap = new UIMinimap2();

            minimap.Parent = this;
            this.Minimap   = minimap;
            this.Windows.Add(minimap);

            var worldmap = new UIWorldMap();

            worldmap.Parent     = this;
            worldmap.Visibility = Visibility.Collapsed;
            worldmap.Visible   += Worldmap_Visible;
            this.WorldMap       = worldmap;
            this.Windows.Add(worldmap);

            var topBar = new UITopBar();

            topBar.Parent  = this;
            topBar.IsOnTop = false;
            topBar.SetBinding(UITopBar.WidthProperty, new Binding(UIRoot.WidthProperty)
            {
                Source = this
            });
            topBar.SetBinding(UITopBar.PaddingLeftProperty, new Binding(Window.WidthProperty)
            {
                Source = minimap
            });
            topBar.SetBinding(UITopBar.IsShortModeProperty, new Binding(Window.VisibilityProperty)
            {
                Source = minimap, Converter = UIHelper.CreateConverter((Visibility o) => o == Visibility.Visible)
            });
            this.TopBar = topBar;
            this.Windows.Add(topBar);
        }
Beispiel #3
0
        private UIElement GetTabContent1()
        {
            Grid grid = new Grid();

            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(24, GridUnitType.Pixel)
            });
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(24, GridUnitType.Pixel)
            });
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(24, GridUnitType.Pixel)
            });
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(24, GridUnitType.Pixel)
            });
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(24, GridUnitType.Pixel)
            });
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(24, GridUnitType.Pixel)
            });
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(24, GridUnitType.Pixel)
            });
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(24, GridUnitType.Pixel)
            });
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(24, GridUnitType.Pixel)
            });
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(24, GridUnitType.Pixel)
            });
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(24, GridUnitType.Pixel)
            });
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(24, GridUnitType.Pixel)
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition());
            grid.ColumnDefinitions.Add(new ColumnDefinition());

            TextBlock lbl1 = new TextBlock();

            lbl1.VerticalAlignment = VerticalAlignment.Center;
            lbl1.Text       = "背景音乐";
            lbl1.Foreground = Brushes.Yellow;
            Grid.SetRow(lbl1, 0);
            Grid.SetColumn(lbl1, 0);
            grid.Children.Add(lbl1);

            CheckBox chk1 = new CheckBox();

            chk1.Content = "不在最前时自动静音";
            chk1.Margin  = new Thickness(18, 0, 0, 0);
            chk1.SetBinding(CheckBox.IsCheckedProperty, new Binding(nameof(UIOptionsDataModel.MuteOnLeaveFocus)));
            Grid.SetRow(chk1, 1);
            Grid.SetColumn(chk1, 0);
            Grid.SetColumnSpan(chk1, 2);
            grid.Children.Add(chk1);

            StackPanel pnl1 = new StackPanel();

            pnl1.Orientation = Orientation.Horizontal;
            Grid.SetRow(pnl1, 2);
            Grid.SetColumn(pnl1, 0);
            Grid.SetColumnSpan(pnl1, 2);
            grid.Children.Add(pnl1);

            TextBlock lbl2 = new TextBlock();

            lbl2.TextAlignment       = TextAlignment.Center;
            lbl2.HorizontalAlignment = HorizontalAlignment.Center;
            lbl2.VerticalAlignment   = VerticalAlignment.Center;
            lbl2.Padding             = new Thickness(24, 0, 0, 0);
            lbl2.Text = "音量";
            pnl1.Children.Add(lbl2);

            Slider slider1 = new Slider();

            slider1.Minimum = 0f;
            slider1.Maximum = 1f;
            slider1.Width   = 100;
            slider1.SetBinding(Slider.ValueProperty, new Binding(nameof(UIOptionsDataModel.Volume)));
            pnl1.Children.Add(slider1);

            TextBlock lblVol = new TextBlock();

            lblVol.TextAlignment       = TextAlignment.Center;
            lblVol.HorizontalAlignment = HorizontalAlignment.Left;
            lblVol.VerticalAlignment   = VerticalAlignment.Center;
            lblVol.Padding             = new Thickness(12, 0, 0, 0);
            lblVol.SetBinding(TextBlock.TextProperty, new Binding(Slider.ValueProperty)
            {
                Source    = slider1,
                Converter = UIHelper.CreateConverter(o => string.Format("{0:0}", ((float)o * 100)))
            });
            pnl1.Children.Add(lblVol);

            TextBlock lbl3 = new TextBlock();

            lbl3.VerticalAlignment = VerticalAlignment.Center;
            lbl3.Text       = "默认字体";
            lbl3.Foreground = Brushes.Yellow;
            Grid.SetRow(lbl3, 3);
            Grid.SetColumn(lbl3, 0);
            grid.Children.Add(lbl3);

            ComboBox cmb1 = new ComboBox();

            cmb1.ItemsSource = (IEnumerable <string>) this.FindResource(MapRenderResourceKey.FontList); //source reference has bugs.
            cmb1.SetBinding(ComboBox.SelectedIndexProperty, new Binding(nameof(UIOptionsDataModel.SelectedFont)));
            Grid.SetRow(cmb1, 3);
            Grid.SetColumn(cmb1, 1);
            grid.Children.Add(cmb1);

            TextBlock lbl4 = new TextBlock();

            lbl4.VerticalAlignment = VerticalAlignment.Center;
            lbl4.Text       = "地图视窗";
            lbl4.Foreground = Brushes.Yellow;
            Grid.SetRow(lbl4, 4);
            Grid.SetColumn(lbl4, 0);
            grid.Children.Add(lbl4);

            CheckBox chk2 = new CheckBox();

            chk2.Content = "限制地图范围";
            chk2.Margin  = new Thickness(18, 0, 0, 0);
            chk2.SetBinding(CheckBox.IsCheckedProperty, new Binding(nameof(UIOptionsDataModel.ClipMapRegion)));
            Grid.SetRow(chk2, 5);
            Grid.SetColumn(chk2, 0);
            Grid.SetColumnSpan(chk2, 2);
            grid.Children.Add(chk2);

            TextBlock lbl5 = new TextBlock();

            lbl5.VerticalAlignment = VerticalAlignment.Center;
            lbl5.Text       = "渲染";
            lbl5.Foreground = Brushes.Yellow;
            Grid.SetRow(lbl5, 6);
            Grid.SetColumn(lbl5, 0);
            grid.Children.Add(lbl5);

            CheckBox chk3 = new CheckBox();

            chk3.Content = "使用D2D绘制";
            chk3.Margin  = new Thickness(18, 0, 0, 0);
            chk3.SetBinding(CheckBox.IsCheckedProperty, new Binding(nameof(UIOptionsDataModel.UseD2dRenderer)));
            Grid.SetRow(chk3, 7);
            Grid.SetColumn(chk3, 0);
            Grid.SetColumnSpan(chk3, 2);
            grid.Children.Add(chk3);

            CheckBox chk4 = new CheckBox();

            chk4.Content = "显示Npc名称";
            chk4.Margin  = new Thickness(18, 0, 0, 0);
            chk4.SetBinding(CheckBox.IsCheckedProperty, new Binding(nameof(UIOptionsDataModel.NpcNameVisible)));
            Grid.SetRow(chk4, 8);
            Grid.SetColumn(chk4, 0);
            Grid.SetColumnSpan(chk4, 2);
            grid.Children.Add(chk4);

            CheckBox chk5 = new CheckBox();

            chk5.Content = "显示Mob名称";
            chk5.Margin  = new Thickness(18, 0, 0, 0);
            chk5.SetBinding(CheckBox.IsCheckedProperty, new Binding(nameof(UIOptionsDataModel.MobNameVisible)));
            Grid.SetRow(chk5, 9);
            Grid.SetColumn(chk5, 0);
            Grid.SetColumnSpan(chk5, 2);
            grid.Children.Add(chk5);

            TextBlock lbl6 = new TextBlock();

            lbl6.VerticalAlignment = VerticalAlignment.Center;
            lbl6.Text       = "截图";
            lbl6.Foreground = Brushes.Yellow;
            Grid.SetRow(lbl6, 10);
            Grid.SetColumn(lbl6, 0);
            grid.Children.Add(lbl6);

            StackPanel pnl2 = new StackPanel();

            pnl2.Orientation = Orientation.Horizontal;
            Grid.SetRow(pnl2, 11);
            Grid.SetColumn(pnl2, 0);
            Grid.SetColumnSpan(pnl2, 2);
            grid.Children.Add(pnl2);

            TextBlock lbl7 = new TextBlock();

            lbl7.TextAlignment       = TextAlignment.Center;
            lbl7.HorizontalAlignment = HorizontalAlignment.Center;
            lbl7.VerticalAlignment   = VerticalAlignment.Center;
            lbl7.Padding             = new Thickness(24, 0, 0, 0);
            lbl7.Text = "背景色(argb)";
            pnl2.Children.Add(lbl7);

            TextBox tb1 = new TextBox();

            tb1.Width = 60;
            tb1.HorizontalAlignment = HorizontalAlignment.Center;
            tb1.VerticalAlignment   = VerticalAlignment.Center;
            tb1.MaxLength           = 8;
            tb1.SetBinding(TextBox.TextProperty, new Binding(nameof(UIOptionsDataModel.ScreenshotBackgroundColor)));
            pnl2.Children.Add(tb1);

            Canvas img1 = new Canvas();

            img1.Width  = 20;
            img1.Height = 20;
            img1.Margin = new Thickness(2);
            img1.SetBinding(Canvas.BackgroundProperty, new Binding(nameof(UIOptionsDataModel.ScreenshotBackgroundColor))
            {
                Converter = UIHelper.CreateConverter((string s) => ColorWConverter.TryParse(s, out var color) ? new SolidColorBrush(color) : null)
            });
Beispiel #4
0
        private UIElement GetTabContent1()
        {
            Grid grid = new Grid();

            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(24, GridUnitType.Pixel)
            });
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(24, GridUnitType.Pixel)
            });
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(24, GridUnitType.Pixel)
            });
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(24, GridUnitType.Pixel)
            });
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(24, GridUnitType.Pixel)
            });
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(24, GridUnitType.Pixel)
            });
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(24, GridUnitType.Pixel)
            });
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(24, GridUnitType.Pixel)
            });
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(24, GridUnitType.Pixel)
            });
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(24, GridUnitType.Pixel)
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition());
            grid.ColumnDefinitions.Add(new ColumnDefinition());

            TextBlock lbl1 = new TextBlock();

            lbl1.VerticalAlignment = VerticalAlignment.Center;
            lbl1.Text       = "BGM";
            lbl1.Foreground = Brushes.Yellow;
            Grid.SetRow(lbl1, 0);
            Grid.SetColumn(lbl1, 0);
            grid.Children.Add(lbl1);

            CheckBox chk1 = new CheckBox();

            chk1.Content = "Mute BGM when in Background";
            chk1.Margin  = new Thickness(18, 0, 0, 0);
            chk1.SetBinding(CheckBox.IsCheckedProperty, new Binding(nameof(UIOptionsDataModel.MuteOnLeaveFocus)));
            Grid.SetRow(chk1, 1);
            Grid.SetColumn(chk1, 0);
            Grid.SetColumnSpan(chk1, 2);
            grid.Children.Add(chk1);

            StackPanel pnl1 = new StackPanel();

            pnl1.Orientation = Orientation.Horizontal;
            Grid.SetRow(pnl1, 2);
            Grid.SetColumn(pnl1, 0);
            Grid.SetColumnSpan(pnl1, 2);
            grid.Children.Add(pnl1);

            TextBlock lbl2 = new TextBlock();

            lbl2.TextAlignment       = TextAlignment.Center;
            lbl2.HorizontalAlignment = HorizontalAlignment.Center;
            lbl2.VerticalAlignment   = VerticalAlignment.Center;
            lbl2.Padding             = new Thickness(24, 0, 0, 0);
            lbl2.Text = "Volume";
            pnl1.Children.Add(lbl2);

            Slider slider1 = new Slider();

            slider1.Minimum = 0f;
            slider1.Maximum = 1f;
            slider1.Width   = 100;
            slider1.SetBinding(Slider.ValueProperty, new Binding(nameof(UIOptionsDataModel.Volume)));
            pnl1.Children.Add(slider1);

            TextBlock lblVol = new TextBlock();

            lblVol.TextAlignment       = TextAlignment.Center;
            lblVol.HorizontalAlignment = HorizontalAlignment.Left;
            lblVol.VerticalAlignment   = VerticalAlignment.Center;
            lblVol.Padding             = new Thickness(12, 0, 0, 0);
            lblVol.SetBinding(TextBlock.TextProperty, new Binding(Slider.ValueProperty)
            {
                Source    = slider1,
                Converter = UIHelper.CreateConverter(o => string.Format("{0:0}", ((float)o * 100)))
            });
            pnl1.Children.Add(lblVol);

            TextBlock lbl3 = new TextBlock();

            lbl3.VerticalAlignment = VerticalAlignment.Center;
            lbl3.Text       = "Default Font";
            lbl3.Foreground = Brushes.Yellow;
            Grid.SetRow(lbl3, 3);
            Grid.SetColumn(lbl3, 0);
            grid.Children.Add(lbl3);

            ComboBox cmb1 = new ComboBox();

            cmb1.ItemsSource = (IEnumerable <string>) this.FindResource(MapRenderResourceKey.FontList); //source reference has bugs.
            cmb1.SetBinding(ComboBox.SelectedIndexProperty, new Binding(nameof(UIOptionsDataModel.SelectedFont)));
            Grid.SetRow(cmb1, 3);
            Grid.SetColumn(cmb1, 1);
            grid.Children.Add(cmb1);

            TextBlock lbl4 = new TextBlock();

            lbl4.VerticalAlignment = VerticalAlignment.Center;
            lbl4.Text       = "Map Window";
            lbl4.Foreground = Brushes.Yellow;
            Grid.SetRow(lbl4, 4);
            Grid.SetColumn(lbl4, 0);
            grid.Children.Add(lbl4);

            CheckBox chk2 = new CheckBox();

            chk2.Content = "Limit Map to visible range";
            chk2.Margin  = new Thickness(18, 0, 0, 0);
            chk2.SetBinding(CheckBox.IsCheckedProperty, new Binding(nameof(UIOptionsDataModel.ClipMapRegion)));
            Grid.SetRow(chk2, 5);
            Grid.SetColumn(chk2, 0);
            Grid.SetColumnSpan(chk2, 2);
            grid.Children.Add(chk2);

            TextBlock lbl5 = new TextBlock();

            lbl5.VerticalAlignment = VerticalAlignment.Center;
            lbl5.Text       = "Rendering";
            lbl5.Foreground = Brushes.Yellow;
            Grid.SetRow(lbl5, 6);
            Grid.SetColumn(lbl5, 0);
            grid.Children.Add(lbl5);

            CheckBox chk3 = new CheckBox();

            chk3.Content = "Use D2D to draw";
            chk3.Margin  = new Thickness(18, 0, 0, 0);
            chk3.SetBinding(CheckBox.IsCheckedProperty, new Binding(nameof(UIOptionsDataModel.UseD2dRenderer)));
            Grid.SetRow(chk3, 7);
            Grid.SetColumn(chk3, 0);
            Grid.SetColumnSpan(chk3, 2);
            grid.Children.Add(chk3);

            CheckBox chk4 = new CheckBox();

            chk4.Content = "Display NPC names";
            chk4.Margin  = new Thickness(18, 0, 0, 0);
            chk4.SetBinding(CheckBox.IsCheckedProperty, new Binding(nameof(UIOptionsDataModel.NpcNameVisible)));
            Grid.SetRow(chk4, 8);
            Grid.SetColumn(chk4, 0);
            Grid.SetColumnSpan(chk4, 2);
            grid.Children.Add(chk4);

            CheckBox chk5 = new CheckBox();

            chk5.Content = "Display Mob names";
            chk5.Margin  = new Thickness(18, 0, 0, 0);
            chk5.SetBinding(CheckBox.IsCheckedProperty, new Binding(nameof(UIOptionsDataModel.MobNameVisible)));
            Grid.SetRow(chk5, 9);
            Grid.SetColumn(chk5, 0);
            Grid.SetColumnSpan(chk5, 2);
            grid.Children.Add(chk5);

            ScrollViewer viewer = new ScrollViewer();

            viewer.Content = grid;
            return(viewer);
        }
        private void InitializeComponents()
        {
            Style style = RootStyle.CreateRootStyle();

            style.TargetType = this.GetType();
            this.Style       = style;
            this.Background  = null;

            var minimap = new UIMinimap2();

            minimap.Parent = this;
            this.Minimap   = minimap;
            this.Windows.Add(minimap);

            var worldmap = new UIWorldMap();

            worldmap.Parent = this;
            worldmap.Hide();
            worldmap.Visible += Worldmap_Visible;
            this.WorldMap     = worldmap;
            this.Windows.Add(worldmap);

            var topBar = new UITopBar();

            topBar.Parent  = this;
            topBar.IsOnTop = false;
            topBar.SetBinding(UITopBar.WidthProperty, new Binding(UIRoot.WidthProperty)
            {
                Source = this
            });
            topBar.SetBinding(UITopBar.PaddingLeftProperty, new Binding(Window.WidthProperty)
            {
                Source = minimap
            });
            topBar.SetBinding(UITopBar.IsShortModeProperty, new Binding(Window.VisibilityProperty)
            {
                Source = minimap, Converter = UIHelper.CreateConverter((Visibility o) => o == Visibility.Visible)
            });
            this.TopBar = topBar;
            this.Windows.Add(topBar);

            var chatBox = new UIChatBox();

            chatBox.Parent = this;
            chatBox.SetBinding(UIChatBox.TopProperty, new Binding(HeightProperty)
            {
                Source = this, Converter = UIHelper.CreateConverter((float height) => height - chatBox.Height)
            });
            this.ChatBox = chatBox;
            this.Windows.Add(chatBox);

            ImageManager.Instance.AddImage(nameof(MRes.Basic_img_BtOK4_normal_0));
            ImageManager.Instance.AddImage(nameof(MRes.Basic_img_BtOK4_mouseOver_0));
            ImageManager.Instance.AddImage(nameof(MRes.Basic_img_BtOK4_pressed_0));
            ImageManager.Instance.AddImage(nameof(MRes.Basic_img_BtOK4_disabled_0));
            ImageManager.Instance.AddImage(nameof(MRes.Basic_img_BtNo3_normal_0));
            ImageManager.Instance.AddImage(nameof(MRes.Basic_img_BtNo3_mouseOver_0));
            ImageManager.Instance.AddImage(nameof(MRes.Basic_img_BtNo3_pressed_0));
            ImageManager.Instance.AddImage(nameof(MRes.Basic_img_BtNo3_disabled_0));
            ImageManager.Instance.AddImage(nameof(MRes.Basic_img_BtCancel4_normal_0));
            ImageManager.Instance.AddImage(nameof(MRes.Basic_img_BtCancel4_mouseOver_0));
            ImageManager.Instance.AddImage(nameof(MRes.Basic_img_BtCancel4_pressed_0));
            ImageManager.Instance.AddImage(nameof(MRes.Basic_img_BtCancel4_disabled_0));
            ImageManager.Instance.AddImage(nameof(MRes.Basic_img_BtClose3_normal_0));
            ImageManager.Instance.AddImage(nameof(MRes.Basic_img_BtClose3_mouseOver_0));
            ImageManager.Instance.AddImage(nameof(MRes.Basic_img_BtClose3_pressed_0));
            ImageManager.Instance.AddImage(nameof(MRes.Basic_img_BtClose3_disabled_0));
            this.Resources[CommonResourceKeys.MessageBoxWindowStyleKey] = MessageBoxStyle.CreateMessageBoxStyle();
        }
Beispiel #6
0
        private UIElement GetTabContent1()
        {
            Grid grid = new Grid();

            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(24, GridUnitType.Pixel)
            });
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(24, GridUnitType.Pixel)
            });
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(24, GridUnitType.Pixel)
            });
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(24, GridUnitType.Pixel)
            });
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(24, GridUnitType.Pixel)
            });
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(24, GridUnitType.Pixel)
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition());
            grid.ColumnDefinitions.Add(new ColumnDefinition());

            TextBlock lbl1 = new TextBlock();

            lbl1.VerticalAlignment = VerticalAlignment.Center;
            lbl1.Text       = "背景音乐";
            lbl1.Foreground = Brushes.Yellow;
            Grid.SetRow(lbl1, 0);
            Grid.SetColumn(lbl1, 0);
            grid.Children.Add(lbl1);

            CheckBox chk1 = new CheckBox();

            chk1.Content = "不在最前时自动静音";
            chk1.Margin  = new Thickness(18, 0, 0, 0);
            chk1.SetBinding(CheckBox.IsCheckedProperty, new Binding(nameof(UIOptionsDataModel.MuteOnLeaveFocus)));
            Grid.SetRow(chk1, 1);
            Grid.SetColumn(chk1, 0);
            Grid.SetColumnSpan(chk1, 2);
            grid.Children.Add(chk1);

            StackPanel pnl1 = new StackPanel();

            pnl1.Orientation = Orientation.Horizontal;
            Grid.SetRow(pnl1, 2);
            Grid.SetColumn(pnl1, 0);
            Grid.SetColumnSpan(pnl1, 2);
            grid.Children.Add(pnl1);

            TextBlock lbl2 = new TextBlock();

            lbl2.TextAlignment       = TextAlignment.Center;
            lbl2.HorizontalAlignment = HorizontalAlignment.Center;
            lbl2.VerticalAlignment   = VerticalAlignment.Center;
            lbl2.Padding             = new Thickness(24, 0, 0, 0);
            lbl2.Text = "音量";
            pnl1.Children.Add(lbl2);

            Slider slider1 = new Slider();

            slider1.Minimum = 0f;
            slider1.Maximum = 1f;
            slider1.Width   = 100;
            slider1.SetBinding(Slider.ValueProperty, new Binding(nameof(UIOptionsDataModel.Volume)));
            pnl1.Children.Add(slider1);

            TextBlock lblVol = new TextBlock();

            lblVol.TextAlignment       = TextAlignment.Center;
            lblVol.HorizontalAlignment = HorizontalAlignment.Left;
            lblVol.VerticalAlignment   = VerticalAlignment.Center;
            lblVol.Padding             = new Thickness(12, 0, 0, 0);
            lblVol.SetBinding(TextBlock.TextProperty, new Binding(Slider.ValueProperty)
            {
                Source    = slider1,
                Converter = UIHelper.CreateConverter(o => string.Format("{0:0}", ((float)o * 100)))
            });
            pnl1.Children.Add(lblVol);

            TextBlock lbl3 = new TextBlock();

            lbl3.VerticalAlignment = VerticalAlignment.Center;
            lbl3.Text       = "默认字体";
            lbl3.Foreground = Brushes.Yellow;
            Grid.SetRow(lbl3, 3);
            Grid.SetColumn(lbl3, 0);
            grid.Children.Add(lbl3);

            ComboBox cmb1 = new ComboBox();

            cmb1.ItemsSource = (IEnumerable <string>) this.FindResource(MapRenderResourceKey.FontList); //source reference has bugs.
            cmb1.SetBinding(ComboBox.SelectedIndexProperty, new Binding(nameof(UIOptionsDataModel.SelectedFont)));
            Grid.SetRow(cmb1, 3);
            Grid.SetColumn(cmb1, 1);
            grid.Children.Add(cmb1);

            TextBlock lbl4 = new TextBlock();

            lbl4.VerticalAlignment = VerticalAlignment.Center;
            lbl4.Text       = "地图视窗";
            lbl4.Foreground = Brushes.Yellow;
            Grid.SetRow(lbl4, 4);
            Grid.SetColumn(lbl4, 0);
            grid.Children.Add(lbl4);

            CheckBox chk2 = new CheckBox();

            chk2.Content = "限制地图范围";
            chk2.Margin  = new Thickness(18, 0, 0, 0);
            chk2.SetBinding(CheckBox.IsCheckedProperty, new Binding(nameof(UIOptionsDataModel.ClipMapRegion)));
            Grid.SetRow(chk2, 5);
            Grid.SetColumn(chk2, 0);
            Grid.SetColumnSpan(chk2, 2);
            grid.Children.Add(chk2);

            return(grid);
        }