Hi! I use RadCombobox in my WPF MVVM application. I use Prism 6 and Prism UserControl(WPF) where I set RadComboBox. This Prism UserControl(WPF) is in one of Prism module projects in the application solution but not in the Shell project. Below is declaration and creation of ObservableCollection in Model (I bind RadComboBox to this collection in View that is abovementioned Prism UserControl(WPF)):
public ObservableCollection<string> AvailableComPortsNames { get; set; }
this.AvailableComPortsNames = new ObservableCollection<string>(SerialPort.GetPortNames()); // in Model's constructor.
Below is declaration and creation of Model instance in ViewModel:
public ConnectionSettingsModel ConnectionSettingsModel
{
get { return this._connectionSettingsModel; }
set { this.SetProperty(ref this._connectionSettingsModel, value); }
}
this.ConnectionSettingsModel = new ConnectionSettingsModel(); // in ViewModel's constructor.
Below is View in a shortened form:
<UserControl x:Class="ConnectDisconnect.Views.ConnectionSettingsView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:prism="http://prismlibrary.com/"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
prism:ViewModelLocator.AutoWireViewModel="True">
<Grid>
. . . . . . . . . . .
<Label Grid.Row="0" Grid.Column="0" Content="Serial Port" HorizontalAlignment="Right"/>
<telerik:RadComboBox x:Name="radComboBox" HorizontalAlignment="Left" Margin="1,3,1,2" Grid.Row="0" Grid.Column="1"
VerticalAlignment="Top" Width="250" IsReadOnly="True"
ItemsSource="{Binding ConnectionSettingsModel.AvailableComPortsNames}" SelectedValue="{Binding SelectedComportName}"/>
</Grid>
Binding works good but the appearance of RadComboBox in runtime is very starnge. Please see attached files: 'RadCombobox_is_Closed.PNG' and 'RadCombobox_after_Element_Selection.PNG'. You can see there that RadComboBox has no marked border! Why? Help me solve this problem.
P.S. Just in case I display below ApplicationResources section of App.xaml file that is in the Shell project of application solution.
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Telerik.Windows.Themes.Office2013;component/Themes/System.Windows.xaml" />
<ResourceDictionary Source="/Telerik.Windows.Themes.Office2013;component/Themes/Telerik.Windows.Controls.xaml" />
<ResourceDictionary Source="/Telerik.Windows.Themes.Office2013;component/Themes/Telerik.Windows.Controls.Navigation.xaml" />
<ResourceDictionary Source="/Telerik.Windows.Themes.Office2013;component/Themes/Telerik.Windows.Controls.Docking.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style TargetType="views:Shell" BasedOn="{StaticResource RadWindowStyle}" />
</ResourceDictionary>
</Application.Resources>
Shell is RadWindow and the application solution was created as Telerik Empty Project. And Shell was added to the application after the application creation.