Click here to Skip to main content
15,359,445 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: Conditional DataBinding to UI Elements Pin
Mycroft Holmes5-Feb-12 15:15
professionalMycroft Holmes5-Feb-12 15:15 
AnswerRe: Conditional DataBinding to UI Elements Pin
Mycroft Holmes5-Feb-12 15:16
professionalMycroft Holmes5-Feb-12 15:16 
GeneralRe: Conditional DataBinding to UI Elements Pin
Andy_L_J5-Feb-12 15:43
MemberAndy_L_J5-Feb-12 15:43 
QuestionOwn TreeViewItem with image and text Pin
Mc_Topaz2-Feb-12 22:20
MemberMc_Topaz2-Feb-12 22:20 
AnswerRe: Own TreeViewItem with image and text Pin
Mc_Topaz3-Feb-12 0:52
MemberMc_Topaz3-Feb-12 0:52 
GeneralGridSplitter Conundrum Pin
Gil Yoder1-Feb-12 15:31
MemberGil Yoder1-Feb-12 15:31 
QuestionRe: GridSplitter Conundrum Pin
Gil Yoder2-Feb-12 9:44
MemberGil Yoder2-Feb-12 9:44 
AnswerRe: GridSplitter Conundrum Pin
SledgeHammer012-Feb-12 11:40
MemberSledgeHammer012-Feb-12 11:40 
Well, I'm not going to read "5 pages" of XAML in your previous post, so its good that you cut it down. Haha Smile | :) . You discovered a bug that I reported to Microsoft a year or two ago. I reported it in .NET 4.0. GridSplitter ignores the MinWidth on the last column in certain situations.

I invented a work-around at the time. Here you go. Just use local:GridSplitterEx (or whatever) instead of GridSplitter and you'll be off to the races:

C#
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;

namespace Shared
{
    public class GridSplitterEx : GridSplitter
    {
        #region Constructors

        public GridSplitterEx()
        {
        }

        #endregion

        #region Overrides

        protected override void OnMouseMove(MouseEventArgs e)
        {
            // fix for GridSplitter bug, it doesn't respect the last columns' minimum width property

            if (IsMouseCaptureWithin)
            {
                Grid grid = Parent as Grid;

                if (grid != null)
                {
                    ColumnDefinition cd = grid.ColumnDefinitions[grid.ColumnDefinitions.Count - 1];

                    if (cd.MinWidth > 0)
                    {
                        double dWidth = grid.ActualWidth;

                        if (dWidth > 0)
                        {
                            Point ptGrid = e.GetPosition(grid);

                            if (dWidth - ptGrid.X < cd.MinWidth + 12)
                                return;
                        }
                    }
                }
            }

            base.OnMouseMove(e);
        }

        #endregion
    }
}


As a side note, I don't quite remember whats with the + 12 magic number, but there was a reason Smile | :) .
GeneralRe: GridSplitter Conundrum Pin
Gil Yoder2-Feb-12 14:09
MemberGil Yoder2-Feb-12 14:09 
GeneralRe: GridSplitter Conundrum Pin
SledgeHammer012-Feb-12 14:37
MemberSledgeHammer012-Feb-12 14:37 
GeneralRe: GridSplitter Conundrum Pin
Gil Yoder2-Feb-12 15:43
MemberGil Yoder2-Feb-12 15:43 
SuggestionRe: GridSplitter Conundrum Pin
Gil Yoder2-Feb-12 18:59
MemberGil Yoder2-Feb-12 18:59 
GeneralRe: GridSplitter Conundrum Pin
SledgeHammer013-Feb-12 7:17
MemberSledgeHammer013-Feb-12 7:17 
Questionadding/removing ListView columns at runtime (revisited) Pin
Vincent Beek1-Feb-12 0:20
MemberVincent Beek1-Feb-12 0:20 
AnswerRe: adding/removing ListView columns at runtime (revisited) Pin
Abhinav S1-Feb-12 0:36
MemberAbhinav S1-Feb-12 0:36 
GeneralRe: adding/removing ListView columns at runtime (revisited) Pin
Mycroft Holmes1-Feb-12 11:53
professionalMycroft Holmes1-Feb-12 11:53 
QuestionBinding list of items to IntemsControl in WPF Pin
rams230-Jan-12 23:14
Memberrams230-Jan-12 23:14 
AnswerRe: Binding list of items to IntemsControl in WPF Pin
Wayne Gaylard31-Jan-12 0:10
professionalWayne Gaylard31-Jan-12 0:10 
GeneralRe: Binding list of items to IntemsControl in WPF Pin
rams231-Jan-12 0:36
Memberrams231-Jan-12 0:36 
GeneralRe: Binding list of items to IntemsControl in WPF Pin
Wayne Gaylard31-Jan-12 0:39
professionalWayne Gaylard31-Jan-12 0:39 
GeneralRe: Binding list of items to IntemsControl in WPF Pin
Abhinav S1-Feb-12 16:26
MemberAbhinav S1-Feb-12 16:26 
GeneralRe: Binding list of items to IntemsControl in WPF Pin
Wayne Gaylard1-Feb-12 19:06
professionalWayne Gaylard1-Feb-12 19:06 
QuestionFocusing on elements in MVVM Pin
mi_n30-Jan-12 22:42
Membermi_n30-Jan-12 22:42 
AnswerRe: Focusing on elements in MVVM Pin
Pete O'Hanlon30-Jan-12 23:03
mvaPete O'Hanlon30-Jan-12 23:03 
GeneralRe: Focusing on elements in MVVM Pin
Pete O'Hanlon31-Jan-12 3:34
mvaPete O'Hanlon31-Jan-12 3:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.