MVVM Binding Selected RadOutlookBarItem
- by Christian
Imagine:
[RadOutlookBarItem1]
[RadOutlookBarItem2]
[RadOutlookBar] [CONTENCONTROL]
What i want to achieve is:
User selects one of the RadOutlookBarItem's. Item's tag is bound like:
Tag="{Binding SelectedControl, Mode=TwoWay}"
MVVM Property
public string SelectedControl
{
get { return _showControl; }
set
{
_showControl = value;
OnNotifyPropertyChanged("ShowControl");
}
}
ContentControl has multiple CustomControls and Visibility of those is bound like:
<UserControl.Resources>
<Converters:BoolVisibilityConverter x:Key="BoolViz"/>
</UserControl.Resources>
<Grid x:Name="LayoutRoot" Background="White">
<Views:ViewDocumentSearchControl Visibility="{Binding SelectedControl, Converter={StaticResource BoolViz}, ConverterParameter='viewDocumentSearchControl'}"/>
<Views:ViewStartControl Visibility="{Binding SelectedControl, Converter={StaticResource BoolViz}, ConverterParameter='viewStartControl'}"/>
</Grid>
Converter:
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
// here comes the logic part... should return Visibility.Collapsed : Visibility.Visible based on 'object value' value
System.Diagnostics.Debugger.Break();
return Visibility.Collapsed;
}
now, logically the object value is always set to null. So here's it comes to my question: How can i put a value into the SelectedControl Variable for the RadOutlookBarItem's Tag. I mean something like
Tag="{Binding SelectedControl, Mode=TwoWay, VALUE='i.e.ControlName'"}
So that i can decide, using the Convert Method, whether a specific Control's visibility is either set to collapsed or visible?
help's appreciated
Christian