Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Style for RowHeader in LaneGrid? (Read 4292 times)
Rainer
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 3
Joined: May 24th, 2011
Style for RowHeader in LaneGrid?
May 24th, 2011 at 10:24am
Print Post  
Hi,

I need (for example) to center the Title in the RowHeader.
Is it possible to create a style (in XAML) for the RowHeaders in the LaneGrid?

Is there a chance to control the Width of the RowHeaders, so that no Text of the RowHeader Title is cut away?

regards
Rainer
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Style for RowHeader in LaneGrid?
Reply #1 - May 24th, 2011 at 11:12am
Print Post  
Hi,

This is the default style for headers, it should be possible to copy it and modify the text alignment:

Code
Select All
<Style TargetType="lanes:LaneGridHeaderPresenter">
	<Setter Property="Template">
		<Setter.Value>
			<ControlTemplate TargetType="lanes:LaneGridHeaderPresenter">
				<lanes:FourSidedBorder BorderStyle="{Binding Style}">
					<TextBlock Text="{Binding Title}" />
				</lanes:FourSidedBorder>
			</ControlTemplate>
		</Setter.Value>
	</Setter>
</Style> 



You can set the row header widths through the diagram.LaneGrid.RowHeadersWidths property. It is possible to determine the required header text size by measuring a temporary TextBlock:
http://mindfusion.eu/Forum/YaBB.pl?board=diaglite_disc;action=display;num=127182...

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Rainer
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 3
Joined: May 24th, 2011
Re: Style for RowHeader in LaneGrid?
Reply #2 - May 24th, 2011 at 12:10pm
Print Post  
Hi Stoyan,

thank you for your fast answer!

I am wondering where I can set the LaneGridHeaderPresenter with the new style?

LaneGrid in the diagram has no Property 'LaneGridHeaderPresenter'. How can I access the Presenter?

regards
Rainer
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Style for RowHeader in LaneGrid?
Reply #3 - May 24th, 2011 at 2:22pm
Print Post  
Hi Rainer,

You can define the style in the Resources section of your page Xaml:
Code
Select All
<UserControl.Resources>
	<Style x:Key="ColHeaderStyle" TargetType="lanes:LaneGridHeaderPresenter">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="lanes:LaneGridHeaderPresenter">
					<lanes:FourSidedBorder BorderStyle="{Binding Style}">
						<TextBlock Text="{Binding Title}" Foreground="Orange" TextAlignment="Center" />
					</lanes:FourSidedBorder>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
</UserControl.Resources> 



and then handle the LaneGridHeaderCreated event to assign the style to a header presenter:

Code
Select All
private void OnLaneGridHeaderCreated(object sender, GridHeaderEventArgs e)
{
	if (e.Header.IsColumnHeader)
		e.Presenter.Style = (System.Windows.Style)Resources["ColHeaderStyle"];
} 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Rainer
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 3
Joined: May 24th, 2011
Re: Style for RowHeader in LaneGrid?
Reply #4 - May 24th, 2011 at 2:51pm
Print Post  
Hi Stoyan,

that works pretty fine!

I am very satisfied with your instant help!

regards
Rainer
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint