Hello there,
I would have a very basic question about how to Maximize a RadTileViewItem from within the item itself. Here is my scenario:
I'm using a RadTileView to display some dynamic content (text, images, hyperlinks) into a couple of RadTileViewItems.
I would like to be able to maximize the current RadTileViewItem when the hyperlink is being clicked.
Thanks in advance for any hint!
I would have a very basic question about how to Maximize a RadTileViewItem from within the item itself. Here is my scenario:
I'm using a RadTileView to display some dynamic content (text, images, hyperlinks) into a couple of RadTileViewItems.
I would like to be able to maximize the current RadTileViewItem when the hyperlink is being clicked.
Thanks in advance for any hint!
6 Answers, 1 is accepted
0
Titus
Top achievements
Rank 1
answered on 14 May 2012, 07:30 PM
Hello there,
Here is the 2-steps solution that I've found so far. If you guys do have a better solution, please post it here.
STEP 1: Put a HyperlinkButton inside your <telerik:RadFluidContentControl.Content> </telerik:RadFluidContentControl.Content>as follows:
Here is the 2-steps solution that I've found so far. If you guys do have a better solution, please post it here.
STEP 1: Put a HyperlinkButton inside your <telerik:RadFluidContentControl.Content> </telerik:RadFluidContentControl.Content>as follows:
<
HyperlinkButton
VerticalAlignment
=
"Bottom"
Margin
=
"0"
Padding
=
"0"
IsTabStop
=
"False"
BorderBrush
=
"{x:Null}"
Click
=
"OnClick"
Style
=
"{StaticResource Hyperlink}"
Content
=
"Maximize"
FontFamily
=
"Segoe UI"
FontSize
=
"12"
/>
STEP 2: In your code behind, define the methods OnClick() and FindParentOfType<T>() as follows:
private
void
OnClick(
object
sender, RoutedEventArgs e)
{
HyperlinkButton btn = e.OriginalSource
as
HyperlinkButton;
RadTileViewItem item = FindParentOfType<RadTileViewItem>(btn);
item.TileState = TileViewItemState.Maximized;
}
private
static
T FindParentOfType<T>(UIElement element) where T : UIElement
{
if
(element ==
null
)
return
null
;
DependencyObject parent = System.Windows.Media.VisualTreeHelper.GetParent(element);
while
((parent !=
null
) && !(parent
is
T))
{
parent = System.Windows.Media.VisualTreeHelper.GetParent(parent);
}
return
(T)parent;
}
0
Hello Titus,
The solution that you've found is basically the most straightforward one and my only advise is that you could use our ParentOfType method and you won't have to create our own:
Another way to maximize an item from within its content is to use some of our buttons (because they can have RoutingCommands) like this:
I've attached a sample project showing this so you could examine it and if you have further questions feel free to ask.
Regards,
Zarko
the Telerik team
The solution that you've found is basically the most straightforward one and my only advise is that you could use our ParentOfType method and you won't have to create our own:
HyperlinkButton btn = e.OriginalSource
as
HyperlinkButton;
RadTileViewItem item = btn.ParentOfType<RadTileViewItem>();
item.TileState = TileViewItemState.Maximized;
<
telerik:RadButton
Width
=
"200"
Height
=
"30"
Command
=
"tileView:TileViewCommands.ToggleTileState"
Content
=
"Toggle TileState"
/>
Regards,
Zarko
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Titus
Top achievements
Rank 1
answered on 17 May 2012, 09:20 PM
Thanks Zarko, nice trick! Works like a charm!
0
Henrique
Top achievements
Rank 1
answered on 15 Oct 2013, 02:50 PM
Hi everyone.
I am trying to add a text and a hyperlink in the content of RadTileViewItem like this...
HyperlinkButton hyperlink = new HyperlinkButton();
hyperlink.NavigateUri = new Uri("http://www.uol.com.br", UriKind.Absolute);
hyperlink.Content = "Uol";
item.Content = "Test " + hyperlink;
mainTileView.Items.Add(item);
But it is not working well. Can anyone help me with this issue?
BTY I am planning to add two hyperlinks, one for an image and another for a .doc
Any help will be very welcomed.
I am trying to add a text and a hyperlink in the content of RadTileViewItem like this...
HyperlinkButton hyperlink = new HyperlinkButton();
hyperlink.NavigateUri = new Uri("http://www.uol.com.br", UriKind.Absolute);
hyperlink.Content = "Uol";
item.Content = "Test " + hyperlink;
mainTileView.Items.Add(item);
But it is not working well. Can anyone help me with this issue?
BTY I am planning to add two hyperlinks, one for an image and another for a .doc
Any help will be very welcomed.
0
Henrique
Top achievements
Rank 1
answered on 15 Oct 2013, 02:56 PM
Hi everyone.
I am trying to add a text and a hyperlink in the content of RadTileViewItem like this...
HyperlinkButton hyperlink = new HyperlinkButton();
hyperlink.NavigateUri = new Uri("http://www.uol.com.br", UriKind.Absolute);
hyperlink.Content = "Uol";
item.Content = "Test " + hyperlink;
mainTileView.Items.Add(item);
But it is not working well. Can anyone help me with this issue?
BTY I am planning to add two hyperlinks, one for an image and another for a .doc
Any help will be very welcomed.
I am trying to add a text and a hyperlink in the content of RadTileViewItem like this...
HyperlinkButton hyperlink = new HyperlinkButton();
hyperlink.NavigateUri = new Uri("http://www.uol.com.br", UriKind.Absolute);
hyperlink.Content = "Uol";
item.Content = "Test " + hyperlink;
mainTileView.Items.Add(item);
But it is not working well. Can anyone help me with this issue?
BTY I am planning to add two hyperlinks, one for an image and another for a .doc
Any help will be very welcomed.
0
Hi Henrique,
The problem is in this line of code:
When you do this the hyperlink is used as string(instead of an UIElement) and that's why the content of your item becomes "Test System.Windows.Controls.HyperlinkButton". You should place the "Test" text in a TextBlock and then add it to some panel(Grid, Canvas, StackPanel and etc.) with the hyperlink:
Could you please try this out and if you have further questions feel free to ask.
Regards,
Zarko
Telerik
The problem is in this line of code:
item.Content =
"Test "
+ hyperlink;
StackPanel sp =
new
StackPanel();
sp.Children.Add(
new
TextBlock() { Text =
"Test"
});
sp.Children.Add(hyperlink);
item.Content = sp;
mainTileView.Items.Add(item);
Regards,
Zarko
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>