Hello,
Thank you for your reply and code sample.
Probably the link for Sample is mistaken. It's the same as Video's.
But your code sample was very helpful for me.
So I finally achieved exactly what I want.
Thank you so much!
For your reference, the complete code looks like this.
Edit:
I found a bug in my code below, so fixed it.
---
using Syncfusion.Windows.Tools.Controls;
using System;
using System.Windows;
using System.Windows.Controls;
public class ToolBarAdvEx : ToolBarAdv
{
public ToolBarAdvEx() : base()
{
LayoutUpdated += ToolBarAdvEx_LayoutUpdated;
SizeChanged += ToolBarAdvEx_SizeChanged;
}
const double ToolBarHandlerWidth = 9 + 13;
double ControlsWidth = 0;
ComboBox ComboBox = null;
private void ToolBarAdvEx_LayoutUpdated(object sender, EventArgs e)
{
if (!IsVisible || ControlsWidth > 0)
return;
bool beforeComboBox = true;
foreach (Control c in Items)
{
if (c is ComboBox combo)
{
ComboBox = combo;
SetOverflowMode(c, Syncfusion.Windows.Tools.Controls.OverflowMode.Never);
beforeComboBox = false;
}
else
{
ControlsWidth += c.ActualWidth + c.Margin.Left + c.Margin.Right;
c.Width = c.ActualWidth;
if (beforeComboBox)
SetOverflowMode(c, Syncfusion.Windows.Tools.Controls.OverflowMode.Never);
}
}
ToolBarAdvEx_SizeChanged(this, null);
}
private void ToolBarAdvEx_SizeChanged(object sender, SizeChangedEventArgs e)
{
if (ComboBox == null)
return;
double toolbarwidth = (e == null ? ActualWidth : e.NewSize.Width);
double customizingwidth = toolbarwidth - ControlsWidth - ToolBarHandlerWidth;
customizingwidth = Math.Max(ComboBox.MinWidth, customizingwidth);
ComboBox.Width = customizingwidth;
}
}