本文介绍了c#.net代码“如何减小Windows Phone 8清单中复选框之间的大小”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尊敬的先生/女士,

请解决我在CheckBoxList中遇到的问题。  c#.net代码为"如何减少窗口清单中复选框之间的大小电话8"。

Please solve my problem in CheckBoxList. c#.net code for "How to reduce the size between checkboxes in a checklist for windows phone 8".

我使用stackpanel和checkbox创建了动态复选框列表和一些属性(这些属性来自服务器响应)。当我在单个页面中创建checkboxlist和radiobuttonlist和checkboxlist然后重叠控件。我发现问题
是复选框或单选按钮大小非常高。

I created dynamic checkboxlist using with stackpanel and checkbox and some properties(these properties came from server response). When i am create checkboxlist and radiobuttonlist and checkboxlist in a single page then overlap the controls.I find the problem is that checkbox or radiobutton size is very high .

我的动态控件checkboxlist.same的创建代码为radionbuttonlist。

My dynamic control creation code of checkboxlist.same as radionbuttonlist.

 ControlID = aryControlsData[0].ToString();
                                    double chklWidth = Convert.ToDouble(aryControlsData[1].ToString()) + add_Width;// *2.8;
                                    string Location = aryControlsData[2].ToString();
                                    string[] aryChklLocation = Location.Split(',');
                                    string[] aryChklLocationX = aryChklLocation[0].Split('=');
                                    string[] aryChklLocationY = aryChklLocation[1].Split('=');
                                    string aryChklLocY = aryChklLocationY[1].Replace("}", string.Empty);
                                    double locationX = setX(Convert.ToDouble(aryChklLocationX[1]) + add_X);
                                    // locationX = ((locationX * 100) / 100) + 10;
                                    double locationY = setY(Convert.ToDouble(aryChklLocY) - inputControl_add_Y);//+ add_Y);
                                    //      locationY = ((locationX * 100) / 100) + 100;
                                    double left = 0;
                                    double top = 0;
                                    ControlInputTag = aryControlsData[3].ToString();

                                    string Text;
                                    if (aryControlsData[4].ToString() == null)
                                    {
                                        Text = ""; // aryControlsData[4].ToString();
                                    }
                                    else
                                    {
                                        Text = aryControlsData[4].ToString();
                                    }
                                    string chklItems = aryControlsData[5].ToString();
                                    string[] aryChklItems = chklItems.Split(',');

                                    //string BackgroundColor = aryControlsData[6].ToString();
                                    //      Color BackColour = (Color)typeof(Color).GetProperty(BackgroundColor).GetValue(null, null);
                                    Color colorBackGround = new Color();
                                    if (aryControlsData[6].ToString().Length == 6)
                                    {
                                        string BackgroundColor = "#" + aryControlsData[6].ToString();
                                        // Color BackColour = (Color)typeof(Color).GetProperty(BackgroundColor).GetValue(null, null);
                                        if (BackgroundColor.StartsWith("#"))
                                        {
                                            SolidColorBrush brushBackGround = _10MinClass.ColorHelper.GetColorFromHexa(BackgroundColor);
                                            colorBackGround = brushBackGround.Color;
                                        }
                                    }
                                    string Font_Name = aryControlsData[7].ToString();
                                    double Font_Size = Convert.ToDouble(aryControlsData[8].ToString()) + add_FontSize;
                                    // string Font_ForeColour = aryControlsData[9].ToString();
                                    //       Color Font_ForeColor = (Color)typeof(Color).GetProperty(Font_ForeColour).GetValue(null, null);

                                    Color colorFontForeGround = new Color();
                                    if (aryControlsData[9].ToString().Length == 6)
                                    {
                                        string Font_ForeColour = "#" + aryControlsData[9].ToString();
                                        if (Font_ForeColour.StartsWith("#"))
                                        {
                                            SolidColorBrush brushFontForeGround = _10MinClass.ColorHelper.GetColorFromHexa(Font_ForeColour);
                                            colorFontForeGround = brushFontForeGround.Color;
                                        }
                                    }

                                    string Font_Bold = aryControlsData[10].ToString();
                                    string Font_Underline = aryControlsData[11].ToString();
                                    string Font_Italic = aryControlsData[12].ToString();
                                    double chklHeight = Convert.ToDouble(aryControlsData[13].ToString()) + add_Height;// *2.8;
                                    string GroupName = aryControlsData[14].ToString();
                                    // double border =Convert.ToDouble(aryControlsData[14].ToString());
                                    //string Mobile_Location = aryControlsData[15].ToString();
                                    string Mobile_Location;
                                    if (aryControlsData[15].ToString() == "")
                                    {
                                        Mobile_Location = "";
                                    }
                                    else
                                    {
                                        Mobile_Location = aryControlsData[15].ToString();
                                    }
                                    string Empty1;
                                    if (aryControlsData[16].ToString() == "")
                                    {
                                        Empty1 = "";
                                    }
                                    else
                                    {
                                        Empty1 = aryControlsData[16].ToString();
                                    }
                                    //  string DropDownlistSelection = aryControlsData[16].ToString();
                                    // string Empty = aryControlsData[15].ToString();
                                    //   string ExceptionMsg = aryControlsData[17].ToString();
                                    string DB_Query = aryControlsData[17].ToString();
                                    string DB_Url = aryControlsData[18].ToString();
                                    string DB_SourceName = aryControlsData[19].ToString();
                                    string RepeatLayout = aryControlsData[19].ToString();
                                    string RepeatDirection = aryControlsData[19].ToString();
                                    string RepeatColumn = aryControlsData[19].ToString();
                                    string Index = aryControlsData[21].ToString();

                                    var containerForCheckedListBox = new StackPanel();
                                    containerForCheckedListBox.Name = ControlID;
                                    // containerForCheckedListBox.Margin = new Thickness(left,top,locationX, locationY);
                                    //containerForCheckedListBox.Width = chklWidth;
                                    //containerForCheckedListBox.Height = chklHeight;
                                    //containerForCheckedListBox.Background = new SolidColorBrush(colorBackGround);


                                    for (int item = 0; item < aryChklItems.Length; item++)
                                    {
                                        //var checkBox = new CheckBox();
                                        //checkBox.Content = string.Format("check box #{0}", i + 1);
                                        //containerForCheckBoxList.Children.Add(checkBox);

                                        //RadioButton rdblBox = new RadioButton();
                                        CheckBox chklBox = new CheckBox();
                                        chklBox.Content = aryChklItems[item];
                                        //containerForRadioButtonList.Children.Add(rdblBox);

                                        chklBox.FontFamily = new System.Windows.Media.FontFamily(Font_Name);
                                        chklBox.FontSize = Font_Size;
                                        //      rdb.Foreground = new SolidColorBrush(Font_ForeColor);
                                        if (Font_Bold == "True")
                                        {
                                            chklBox.FontWeight = FontWeights.Bold;
                                        }
                                        if (Font_Italic == "True")
                                        {
                                            chklBox.FontStyle = FontStyles.Italic;
                                        }
                                        if (Font_Underline == "True")
                                        {

                                        }
                                        chklBox.Width = chklWidth;
                                        //chklBox.Height = chklHeight;
                                        chklBox.Foreground = new SolidColorBrush(colorFontForeGround);
                                        containerForCheckedListBox.Children.Add(chklBox);
                                        chklBox = null;
                                    }


                                    // ContentPanel.Children.Add(containerForCheckedListBox);
                                    canvas.Children.Add(containerForCheckedListBox);
                                    Canvas.SetLeft(containerForCheckedListBox, locationX); //---->Left
                                    Canvas.SetTop(containerForCheckedListBox, locationY); //----->Top

请帮助我,这对我的项目非常重要。

Please help me,it is very impartant to my project.

谢谢&问候,

SrinivaaS。

SrinivaaS.

推荐答案


这篇关于c#.net代码“如何减小Windows Phone 8清单中复选框之间的大小”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 16:04