Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8543709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:22:17+00:00 2026-06-11T12:22:17+00:00

GridSplitterControl.xaml <sdk:GridSplitter x:Class=JustLogIt.Common.GridSplitterControl xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml xmlns:d=http://schemas.microsoft.com/expression/blend/2008 xmlns:mc=http://schemas.openxmlformats.org/markup-compatibility/2006 xmlns:sdk=http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk xmlns:telerik=http://schemas.telerik.com/2008/xaml/presentation mc:Ignorable=d> <sdk:GridSplitter.Template> <ControlTemplate TargetType=sdk:GridSplitter> <Grid>

  • 0

GridSplitterControl.xaml

<sdk:GridSplitter x:Class="JustLogIt.Common.GridSplitterControl"
                  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                  xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                  xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
                  xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                  mc:Ignorable="d">
    <sdk:GridSplitter.Template>
        <ControlTemplate TargetType="sdk:GridSplitter">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="auto" />
                </Grid.ColumnDefinitions>
                <telerik:RadButton Grid.Row="0"
                                   Width="10"
                                   Height="20"
                                   HorizontalAlignment="Center"
                                   Click="Click"
                                   Cursor="Hand" />
                <Border Grid.Row="1"
                        BorderBrush="LightGray"
                        BorderThickness="5" />
            </Grid>
        </ControlTemplate>
    </sdk:GridSplitter.Template>
</sdk:GridSplitter>

GridSplitterControl.xaml.cs

    public partial class GridSplitterControl : GridSplitter
    {
        GridLength AutoSize = new GridLength(1.0, GridUnitType.Auto);
        GridLength ZeroSize = new GridLength(0.0);
        public ColumnDefinition Left{ set; get;}
        public GridSplitterControl()
        {
            InitializeComponent();

        }
        public GridSplitterControl(ColumnDefinition ColLeft)
        {
            InitializeComponent();
            Left = ColLeft;
        }
        public void Click(object sender, RoutedEventArgs e)
        {
            if (Left != null)
            {
                Left.MinWidth = 10.0;
                if ((Left.Width.Value + 10) == Left.MinWidth)
                    Left.Width = AutoSize;
                else if (Left.Width.Value != AutoSize.Value)
                    Left.Width = AutoSize;
                else Left.Width = ZeroSize;
            }
            //ClickNotify(sender, e);
        }

        public event EventHandler ClickCompleted;
        private void ClickNotify(object senderAIF, RoutedEventArgs eAIF)
        {
            if (ClickCompleted != null)
                ClickCompleted(senderAIF, eAIF);
        }
    }
  1. The Click event can work, but I have no idea to set the Left(ColumnDefinition) in xaml file which used this Element.
    <Grid x:Name="LayoutRoot1"
                  Grid.Row="1"
                  Margin="5"
                  Background="White">
         <Grid.ColumnDefinitions>
              <ColumnDefinition x:Name="LvCol_10" Width="*" />
              <ColumnDefinition x:Name="LvCol_11" Width="*" />
         </Grid.ColumnDefinitions>
         <Mylayout:GridSplitterControl x:Name="GridSplitter_Left"
                                       Grid.RowSpan="7"
                                       Grid.Column="0"
                                       Width="10"
                                       VerticalAlignment="Stretch"
                                       IsEnabled="True"
                                       Left=? /> < !-- How to set "LvCol_11" in here? -->
    </Grid>`
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T12:22:18+00:00Added an answer on June 11, 2026 at 12:22 pm

    It seems like that you want to set the grid.row as property which is used when the button click.

    Maybe you can try this…

    GridSplitterControl.xaml.cs

    private void UI_Loaded(object sender, RoutedEventArgs e)
    {
        if (sender is GridSplitter)
        {
            Grid ParentGrid = this.ParentOfType<Grid>();
            SetLocation(ParentGrid);
        }
    }
    public void SetLocation(Grid p_Layout)
    {
        int index = Grid.GetColumn(this);
        ColumnDefinition ColLocation = p_Layout.ColumnDefinitions[index];
        ColLocation.MinWidth = 10;
        Left = ColLocation;
    }
    

    Becarefully, besure your element’s parent(Up one level) is grid.

    If parent is stackPanel, border, or rectangle, it will be not working, maybe.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Xaml file which is used in a project which can be
For the life of me I can't get the gridsplitter control to behave in
I need to write a C# WPF program in order to let the user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.