
Rick Mueller
Top achievements
Rank 1
Rick Mueller
asked on 12 Nov 2010, 06:16 AM
Hello, A couple questions
IF a user clicks on a tile to maximize it. Would it be possible to call a event before to maximized.
The code would be something like:
private Tile_Click()
If Tile(1) is Clicked
{
messagebox.show
If ok
{
then Tile(1) is Maximized
else
messagebox cancel
message "you don't want to max this tile
}
I know the code not even close
But and snippet would be great
Thoughts>?
Rick
IF a user clicks on a tile to maximize it. Would it be possible to call a event before to maximized.
The code would be something like:
private Tile_Click()
If Tile(1) is Clicked
{
messagebox.show
If ok
{
then Tile(1) is Maximized
else
messagebox cancel
message "you don't want to max this tile
}
I know the code not even close
But and snippet would be great
Thoughts>?
Rick
9 Answers, 1 is accepted
0
Hello Rick,
One possible solution is to attache to the PreviewTileStateChanged event and handle it depending on the answer from the MessageBox. For example:
The above code will result in:
http://www.screencast.com/users/kiril/folders/Jing/media/efb4f636-36e0-43c9-aca7-ef96c1b75103
Please note that there is a small glitch with the toggle button which will be fixed with the next week's internal build. Let me know how this works for you.
Best wishes,
Kiril Stanoev
the Telerik team
One possible solution is to attache to the PreviewTileStateChanged event and handle it depending on the answer from the MessageBox. For example:
<
telerik:RadTileView
x:Name
=
"tileView1"
PreviewTileStateChanged
=
"RadTileView_PreviewTileStateChanged"
MaximizeMode
=
"One"
>
<
telerik:RadTileViewItem
Header
=
"Item 0"
/>
<
telerik:RadTileViewItem
Header
=
"Item 1"
/>
<
telerik:RadTileViewItem
Header
=
"Item 2"
/>
<
telerik:RadTileViewItem
Header
=
"Item 3"
/>
</
telerik:RadTileView
>
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public
partial
class
MainWindow : Window
{
private
bool
loaded;
public
MainWindow()
{
InitializeComponent();
this
.Dispatcher.BeginInvoke(
new
Action(() =>
{
this
.loaded =
true
;
}), System.Windows.Threading.DispatcherPriority.ApplicationIdle);
}
private
void
RadTileView_PreviewTileStateChanged(
object
sender, Telerik.Windows.Controls.PreviewTileStateChangedEventArgs e)
{
if
(
this
.loaded)
{
RadTileViewItem item = e.OriginalSource
as
RadTileViewItem;
if
(item.TileState == TileViewItemState.Maximized)
{
bool
handled = MessageBox.Show(
"Are you sure"
,
""
, MessageBoxButton.YesNo) == MessageBoxResult.Yes ?
false
:
true
;
e.Handled = (
bool
)handled;
}
}
}
}
The above code will result in:
http://www.screencast.com/users/kiril/folders/Jing/media/efb4f636-36e0-43c9-aca7-ef96c1b75103
Please note that there is a small glitch with the toggle button which will be fixed with the next week's internal build. Let me know how this works for you.
Best wishes,
Kiril Stanoev
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0

Rick Mueller
Top achievements
Rank 1
answered on 15 Nov 2010, 04:58 PM
Kiril,
Thank you for your response.
It works like you said.
I do have one more question.
What if iw want the messagebox only to appear with a certain tile(max), and the rest of the tiles react the same etc.
Regards,
Rick
Thank you for your response.
It works like you said.
I do have one more question.
What if iw want the messagebox only to appear with a certain tile(max), and the rest of the tiles react the same etc.
Regards,
Rick
0

Rick Mueller
Top achievements
Rank 1
answered on 15 Nov 2010, 05:33 PM
private void RadTileView_PreviewTileStateChanged(object sender, Telerik.Windows.Controls.PreviewTileStateChangedEventArgs e)
{
if (this.loaded)
{
this.PrintTile.Items[1] = e.OriginalSource as RadTileViewItem;
if ((this.PrintTile.Items[1] as RadTileViewItem).TileState == TileViewItemState.Maximized)
{
bool handled = MessageBox.Show("Are you sure", "", MessageBoxButton.YesNo) == MessageBoxResult.Yes ? false : true;
e.Handled = (bool)handled;
}
}
}
Any thoughts?
Rick
0
Hello Rick Mueller,
Which parent do you have in mind? Looking at the code, does the exception come from this line :
I am not sure why you are trying to set the tile changing state to the second item in the RadTileView, but did you mean to instantiate this in a new variable like in Kiril's sample:
Is there any particular reason why you would want to do this?
Regards,
Alex Fidanov
the Telerik team
Which parent do you have in mind? Looking at the code, does the exception come from this line :
this.PrintTile.Items[1] = e.OriginalSource as RadTileViewItem; ?
I am not sure why you are trying to set the tile changing state to the second item in the RadTileView, but did you mean to instantiate this in a new variable like in Kiril's sample:
RadTileViewItem item = e.OriginalSource as RadTileViewItem; ?
Is there any particular reason why you would want to do this?
Regards,
Alex Fidanov
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
0

Rick Mueller
Top achievements
Rank 1
answered on 18 Nov 2010, 03:08 PM
Alex,
I was playing with the idea, that only one tileviewitem would invoke the messagebox.
I have senerio where the user can freely choose and select any tiles to max, But If I need to "lockdown" only one tile. The user would need a clearance to max that one certain tile.
I hope that makes sense
Thoughts
Rick
I was playing with the idea, that only one tileviewitem would invoke the messagebox.
I have senerio where the user can freely choose and select any tiles to max, But If I need to "lockdown" only one tile. The user would need a clearance to max that one certain tile.
I hope that makes sense
Thoughts
Rick
0
Hello Rick Mueller,
In this scenarion, Kirils code is very close to what you are trying to achieve. The only thing you need to add is a way to determine how the RadTileViewItem will be designated for lockdown. You could set its Tag property to some value, showing that it is under lockdown and displaying a MessageBox if the Tag is set, or you could create your own attached property for the RadTileViewItem class and check its value in the
PreviewTileStateChanged event.
Best wishes,
Alex Fidanov
the Telerik team
In this scenarion, Kirils code is very close to what you are trying to achieve. The only thing you need to add is a way to determine how the RadTileViewItem will be designated for lockdown. You could set its Tag property to some value, showing that it is under lockdown and displaying a MessageBox if the Tag is set, or you could create your own attached property for the RadTileViewItem class and check its value in the
PreviewTileStateChanged event.
Best wishes,
Alex Fidanov
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
0

Rick Mueller
Top achievements
Rank 1
answered on 19 Nov 2010, 08:12 PM
Alex,,
Thank you
Your talking way beyond my learning curve.
I'll try my best to resolve my sitution you gave me..
Rick
Thank you
Your talking way beyond my learning curve.
I'll try my best to resolve my sitution you gave me..
Rick
0

Rick Mueller
Top achievements
Rank 1
answered on 25 Nov 2010, 08:43 AM
Kiril,
Thanks,
But i can't figure it out,, Is there a way to lock the Tileview so it can't max, min, and restore with code behind?
Thanks,
But i can't figure it out,, Is there a way to lock the Tileview so it can't max, min, and restore with code behind?
0
Hello Rick Mueller,
Please find the attached sample showing how you can lock an item so that it cannot be maximized. The idea is the same with any state you want to lock it down. If you want to block it from any state, just handle the event without checking its TileState. Let me know if you have questions on this.
Greetings,
Alex Fidanov
the Telerik team
Please find the attached sample showing how you can lock an item so that it cannot be maximized. The idea is the same with any state you want to lock it down. If you want to block it from any state, just handle the event without checking its TileState. Let me know if you have questions on this.
Greetings,
Alex Fidanov
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF