Hi,
i want to Expand My Tile using ViewModel.
My RadTileView ItemSource is Binded to DeviceModelsWithoutAux Observable collection of the type DeviceModel (Class).
Through my ViewModel I am binding MaximizedItem Property of RadTileView with an object of DeviceModel type.(which is present inside DeviceModelsWithoutAux )
i am getting a Error in Code behind of my View Containing RadTileView for the event TileStateChanged:
{System.InvalidOperationException: Sequence contains no elements
at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
at Cirrus.Core.UI.Views.Devices.NewDevices.TileView_TileStateChanged(Object sender, RadRoutedEventArgs e)}
On the BOLD line Below
The CodeBehind of my View Containing RadTileView :
The View Containing RadTileView :
My DeviceViewModel Contains:
here I Have Created a State Property inside my DeviceModel Class too:
private FluidContentControlState _state;
public FluidContentControlState State
{
get { return _state; }
set
{
if (_state == value) return;
_state = value;
OnPropertyChanged("State");
}
}
Please Provide your Input for the above Scenario.
Thanks,
Shivam
i want to Expand My Tile using ViewModel.
My RadTileView ItemSource is Binded to DeviceModelsWithoutAux Observable collection of the type DeviceModel (Class).
Through my ViewModel I am binding MaximizedItem Property of RadTileView with an object of DeviceModel type.(which is present inside DeviceModelsWithoutAux )
i am getting a Error in Code behind of my View Containing RadTileView for the event TileStateChanged:
{System.InvalidOperationException: Sequence contains no elements
at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
at Cirrus.Core.UI.Views.Devices.NewDevices.TileView_TileStateChanged(Object sender, RadRoutedEventArgs e)}
On the BOLD line Below
The CodeBehind of my View Containing RadTileView :
private void TileView_TileStateChanged(object sender, Telerik.Windows.RadRoutedEventArgs e)
{
var item = e.Source as RadTileViewItem;
if (item == null) return;
var fluidControl = item.ChildrenOfType<
RadFluidContentControl
>().First();
if (fluidControl == null) return;
switch (item.TileState)
{
case TileViewItemState.Maximized:
DeviceViewModel.ActiveDevice = ((DeviceModel)item.DataContext).Device;
fluidControl.State = FluidContentControlState.Large;
break;
case TileViewItemState.Minimized:
fluidControl.State = FluidContentControlState.Small;
break;
case TileViewItemState.Restored:
fluidControl.State = FluidContentControlState.Normal;
break;
}
}
The View Containing RadTileView :
<
telerikNavigation:RadTileView
TileStateChangeTrigger
=
"SingleClick"
MinimizedItemsPosition
=
"Left"
MinimizedRowHeight
=
"Auto"
MinimizedColumnWidth
=
"150"
TileStateChanged
=
"TileView_TileStateChanged"
ItemsSource
=
"{Binding DeviceModelsWithoutAux}"
PreservePositionWhenMaximized
=
"True"
ContentTemplateSelector
=
"{StaticResource ContentSelector}"
ItemContainerStyle
=
"{StaticResource RadTileViewItemStyle1}"
ItemTemplate
=
"{StaticResource HeaderTemplate}"
x:Name
=
"TileView"
ScrollViewer.HorizontalScrollBarVisibility
=
"Auto"
ScrollViewer.VerticalScrollBarVisibility
=
"Auto"
ScrollBarVisibility
=
"Auto"
RowHeight
=
"237"
ColumnsCount
=
"4"
RowsCount
=
"3"
MaximizedItem
=
"{Binding MaximizedItem}"
/>
</
Grid
>
My DeviceViewModel Contains:
private DeviceModel _maximizedItem;
public DeviceModel MaximizedItem
{
get { return _maximizedItem; }
set
{
if (_maximizedItem == value) return;
_maximizedItem = value;
OnPropertyChanged("MaximizedItem");
}
}
AND
I am Checking from which object has to be Maximized in my function (parameter is the Object):
public void DeviceModelChangedHandler(object parameter)
{
DeviceModel model = parameter as DeviceModel;
foreach (var item in DeviceModelsWithoutAux)
{
if (item._device.DeviceID == model._device.DeviceID)
{
item.State = FluidContentControlState.Large;
MaximizedItem = item;
break;
}
}
}
here I Have Created a State Property inside my DeviceModel Class too:
private FluidContentControlState _state;
public FluidContentControlState State
{
get { return _state; }
set
{
if (_state == value) return;
_state = value;
OnPropertyChanged("State");
}
}
Please Provide your Input for the above Scenario.
Thanks,
Shivam