Reputation: 173
Must attach to the property Width, what I'm doing this:
<ColumnDefinition Width="{Binding Path=TabPanelWidth, RelativeSource={RelativeSource TemplatedParent}}" />
-
public float TabPanelWidth
{
get {return (float) GetValue (TabPanelWidthProperty);}
set {SetValue (TabPanelWidthProperty, value);}
}
public static readonly DependencyProperty TabPanelWidthProperty = DependencyProperty.Register ("TabPanelWidth", typeof (float), typeof (BivTabControl), new UIPropertyMetadata (null));
But I need a possibility to set not only fixed values, but the values which are expressed in XAML as Auto
, 0.5*
, and the like.
Any ideas?
Upvotes: 2
Views: 2464
Reputation: 35584
Your TabPanelWidth
property must be of type GridLength
. With GridLength
you can set auto/star size using GridUnitType
.
In fact, I wonder why binding to a float
works at all.
Upvotes: 3
Reputation: 184296
Use the same datatype instead of a float
, it's called GridLength
.
Upvotes: 0