:: Home

  login:         
  passwords:  

WPF FAQs

WPF General Questions
Concepts Element Tree
Concepts Dependency Property
Concepts Attached Property
Concepts Routed Events
Concepts Resources.
Concepts Animation
Concepts Freezable Object
Concepts Input and Commands.
Concepts Layouts
XAML Inline Styles and Templates
XAML XML Namespaces
XAML Code Behind
XAML Custom Class
XAML Type Converters
Content Model ItemControl
Content Model HeaderedItemsControl
Content Model HeaderedContentControl
Content Model Content Control
Content Model Decorator Content Model
Content Model Panel Content Model
Documents Serialization and Storage
Documents Annotations
Documents Flow Content
Documents Printing
Graphics and Multimedia Rendering Graphics
Graphics and Multimedia Animation and Timing
Graphics and Multimedia 2D Graphics
Graphics and Multimedia 3D Graphics
Graphics and Multimedia Visual Layer
Control Customization Adorners
Control Customization Stylable controls
Control Customization ControlTemplates
Data Data Binding
Data DragandDrop
Data Serialization
Globalization and Localization Attributes
Globalization and Localization Comments
Globalization and Localization Globalization Struc
Application and Deployment ClickOnce
Application and Deployment Frame
Application and Deployment Page
Application and Deployment Navigation
Application and Deployment Setup
Application and Deployment Window
Interoperability Message Loops Between
Interoperability Win32 in WPF
Interoperability WPF in Win32
Interoperability Windows Forms and WPF
Security Trusted Security
Security Partial Trust Security
Tools Microsoft Expression Blend
Tools ZAM3D
Tools XAMLPAD
Controls ToolTip
Controls TextBlock
Controls TabControl
Controls ProgressBar
Controls PrintDialog
Controls Popup
Controls TextBox
Controls Canvas
Controls ComboBox
Controls ListBox
Controls StatusBar
Controls ToolBar
Controls Context Menu
Controls Expander
Controls DocumentViewer
Controls FlowDocumentReader
Controls GroupBox
Controls GridSplitter
Controls Image
Controls Menu
Controls ScrollBar
Controls Slider
Controls RichTextBox
Controls Border
Controls Buttons

SilverLight Interview Qs

SAP Interview Questions

Oracle Interview Questions

PHP Interview Questions

Ajax Interview Questions

IIS 7.0

OOP Interview Questions

Ruby Interview Questions

Sql Server Interview Questions

Winforms Interview Questions

SharePoint 2007 Questions

Microsoft Crm Questions

Controls GridSplitter Questions & FAQs

Questions and answers for Controls GridSplitter.
 

72. Controls GridSplitter

    72.1 How can I make sure that a GridSplitter Is visible ?
    72.2 How can I create and use a GridLengthConverter Object ?

72.1 How can I make sure that a GridSplitter Is visible ?

To prevent hidden GridSplitter controls, do one of the following :

  • Make sure that the GridSplitter controls are the last Children added to the Grid. The following example shows the GridSplitter as the last element in the Children collection of the Grid.

[XAML]

<Grid>

<Grid.ColumnDefinitions>

<ColumnDefinition/>

<ColumnDefinition/>

</Grid.ColumnDefinitions>

<Button Grid.Column="0"/>

<GridSplitter Grid.Column ="0" Background="Blue"/>

</Grid>

  • Set the "Zindex" Property on the GridSplitter to be higher than a control that would otherwise hide it. The following example gives the GridSplitter control a higher 'Zindex' Property than the Button control.

[XAML]

<Grid>

<Grid.ColumnDefinitions>

<ColumnDefinition/>

<ColumnDefinition/>

</Grid.ColumnDefinitions>

<GridSplitter Grid.Column="0" Background="Blue"

Panel.ZIndex="1"/>

<Button Grid.Column="0"/>

</Grid>

  • Set margins on the control that would otherwise hide the GridSplitter so that the GridSplitter is exposed. The following example sets margins on a control that would otherwise overlay and hide the GridSplitter.

[XAML]

<Grid>

<Grid.ColumnDefinitions>

<ColumnDefinition/>

<ColumnDefinition/>

</Grid.ColumnDefinitions>

<GridSplitter Grid.Column ="0" Background="Blue"/>

<Button Grid.Column="0" Margin="0,0,5,0"/>

</Grid>


72.2 How can I create and use a GridLengthConverter Object ?

The following example shows how to create and use an "instance" of the GridLengthConverter object. The example defines a custom method called "changeCol()", which passes the ListBoxItem to a GridLengthConverter that converts the Content of a ListBoxItem to an instance of GridLength. The converted value is then passed back as the value of the "Width" property of the ColumnDefinition element.

[C#]

public void changeColVal(object sender, RoutedEventArgs e)

{

txt1.Text = "Current Grid Column is " + hs1.Value.ToString();

}

public void changeCol(object sender, SelectionChangedEventArgs args)

{

ListBoxItem li = ((sender as ListBox).SelectedItem as ListBoxItem);

GridLengthConverter myGridLengthConverter = new GridLengthConverter();

if (hs1.Value == 0)

{

GridLength gl1 = (GridLength)myGridLengthConverter.ConvertFromString(li.Content.ToString());

col1.Width = gl1;

}

else if (hs1.Value == 1)

{

GridLength gl2 = (GridLength)myGridLengthConverter.ConvertFromString(li.Content.ToString());

col2.Width = gl2;

}

else if (hs1.Value == 2)

{

GridLength gl3 = (GridLength)myGridLengthConverter.ConvertFromString(li.Content.ToString());

col3.Width = gl3;

}

}

bottom user control
::  Home :: Services ::  Prices ::  Request Quote
Copyright 2007, Megasolutions Ltd