This question is locked. New answers and comments are not allowed.
Dear All,
I have a problem placing RadControls (treeview, GridView) inside my custom control with the correct layout.
The issue is that the RadControls is filling the container with no boundaries.
Here is the code for my customer control:
and this is the XAML style as well
The custom control boundaries are visible ... but RadControls are inside overflow the boundaries.
Look in the attached image, the gray header is of the custom control.
What is causing this behavior !?
Thanks and best regards
Waleed
I have a problem placing RadControls (treeview, GridView) inside my custom control with the correct layout.
The issue is that the RadControls is filling the container with no boundaries.
Here is the code for my customer control:
public class WindowContentControl : ContentControl { #region Title Dependency Property /// <summary> /// Title of the control /// </summary> public string Title { get { return (string)GetValue(TitleProperty); } set { SetValue(TitleProperty, value); } } /// <summary> /// Using a DependencyProperty as the backing store for Title. This enables animation, styling, binding, etc... /// </summary> public static readonly DependencyProperty TitleProperty = DependencyProperty.Register("Title", typeof(string), typeof(WindowContentControl), new PropertyMetadata("")); #endregion #region HeaderContent (DependencyProperty) /// <summary> /// A description of the property. /// </summary> public object HeaderContent { get { return (object)GetValue(HeaderContentProperty); } set { SetValue(HeaderContentProperty, value); } } public static readonly DependencyProperty HeaderContentProperty = DependencyProperty.Register("HeaderContent", typeof(object), typeof(WindowContentControl), null); #endregionand this is the XAML style as well
<Style x:Key="HeaderedContentStyle" TargetType="toolkit:HeaderedContentControl"> <Setter Property="VerticalContentAlignment" Value="Stretch" /> <Setter Property="HorizontalContentAlignment" Value="Stretch" /> <Setter Property="BorderThickness" Value="1" /> <Setter Property="BorderBrush" Value="#20000000" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="toolkit:HeaderedContentControl"> <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Margin="1,0,1,0"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition /> </Grid.RowDefinitions> <Grid Margin="0,0,0,2" Grid.Row="0"> <Border CornerRadius="1,1,1,1" Background="{StaticResource HeaderBackgroundBrush}"> <Border.Effect> <DropShadowEffect ShadowDepth="0" BlurRadius="8" Opacity="0.70"/> </Border.Effect> </Border> <TextBlock Style="{StaticResource HeaderLabelStyle}" TextAlignment="Center" HorizontalAlignment="Center" Text="{TemplateBinding Header}" Margin="6,4,6,4"/> </Grid> <ContentPresenter Content="{TemplateBinding Content}" Grid.Row="1" ContentTemplate="{TemplateBinding ContentTemplate}" Cursor="{TemplateBinding Cursor}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"/> </Grid> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style>The custom control boundaries are visible ... but RadControls are inside overflow the boundaries.
Look in the attached image, the gray header is of the custom control.
What is causing this behavior !?
Thanks and best regards
Waleed