Telerik Forums
UI for WPF Forum
1 answer
238 views

I add RadMenuItem inside RadComboBox as below code & screenshot, however, there are 2 borders in the dropdownitem when i selected( please refer to the screenshot-> Red Category), and i can't select the dropdownitem when i click the text in the inner border. It only can be selected by click the outer border. please help to advise. thanks.

 

 

<telerik:RadComboBox  ItemsSource="{Binding Categories}" SelectedItem="{Binding Occurrence.Appointment.Category, Mode=TwoWay}"  Width="136" MinHeight="22"   BorderThickness="0" HorizontalContentAlignment="Left" DisplayMemberPath="CategoryName">
     <telerik:RadComboBox.ItemTemplate>
            <DataTemplate>
                 <telerik:RadMenuItem>
                        <telerik:RadMenuItem.Header>
                          <TextBlock Text="{Binding CategoryName}"></TextBlock>
                         </telerik:RadMenuItem.Header>
                        <telerik:RadMenuItem.Icon>
                               <Rectangle Width="14" Height="14"  HorizontalAlignment="Left" VerticalAlignment="Center" Fill="{Binding CategoryBrush}" />
                       </telerik:RadMenuItem.Icon>
                  </telerik:RadMenuItem>
             </DataTemplate>
       </telerik:RadComboBox.ItemTemplate>
</telerik:RadComboBox>

Nasko
Telerik team
 answered on 05 Aug 2015
11 answers
915 views
Hello,

I am using RadControls_for_WPF35_2010_2_0812_DEV,

When I create a analysis in our solution, i can not exporting this analysis with umlaut letters (Ä,Ü,ß etc.) to excel, html.
Could you help me to fix the problem?

We uses your Export Excel Snippet of your WPF Demo.

#region Export2Excel
private byte groupCount = 0;
private void RadButton_Click(object sender, RoutedEventArgs e)
{
    groupCount = 1;
    string extension = "xls";
    string extension2 = "html";
    var format = ExportFormat.Html;
 
    SaveFileDialog dialog = new SaveFileDialog();
    dialog.DefaultExt = extension;
    dialog.Filter = String.Format("{1} files (*.{0})|*.{0}|{3} files (*.{2})|*.{2}", extension, "Excel", extension2, "HTML");
    dialog.FilterIndex = 1;
 
    if (dialog.ShowDialog() == true)
    {
        if (dialog.FilterIndex == 1)
        {
            using (Stream stream = dialog.OpenFile())
            {
                GridViewExportOptions exportOptions = new GridViewExportOptions();
                exportOptions.Format = format;
                exportOptions.ShowColumnFooters = true;
                exportOptions.ShowColumnHeaders = true;
                exportOptions.ShowGroupFooters = true;
                RadGridView1.Export(stream, exportOptions);
            }
        }
        else
        {
            var str = RadGridView1.ToHtml(true, true);
            var f = File.CreateText(dialog.FileName);
            f.Write(str);
            f.Close();
        }
    }
}
private void RadGridView1_ElementExporting(object sender, GridViewElementExportingEventArgs e)
{
    byte faktor = 10;
    Color groupBGCol = Colors.DarkGray;
    if (e.Element == ExportElement.HeaderRow || e.Element == ExportElement.FooterRow)
    {
        e.Background = Colors.DarkGray;
        e.Foreground = Colors.Black;
        e.FontSize = 20;
        e.FontWeight = FontWeights.Bold;
    }
    else if (e.Element == ExportElement.GroupFooterRow)
    {
        groupCount--;
        groupBGCol.R += Convert.ToByte(groupCount * faktor);
        groupBGCol.G += Convert.ToByte(groupCount * faktor);
        groupBGCol.B += Convert.ToByte(groupCount * faktor);
        e.Background = groupBGCol;
        e.Foreground = Colors.Black;
        e.FontSize = 20;
        e.FontWeight = FontWeights.Bold;
    }
    else if (e.Element == ExportElement.Row)
    {
        e.Background = Colors.LightGray;
        e.Foreground = Colors.Black;
    }
    else if (e.Element == ExportElement.Cell &&
        e.Value != null && e.Value.Equals("Chocolade"))
    {
        e.FontFamily = new FontFamily("Verdana");
        e.Background = Colors.LightGray;
        e.Foreground = Colors.Blue;
    }
    else if (e.Element == ExportElement.GroupHeaderRow)
    {
        groupCount++;
        groupBGCol.R += Convert.ToByte(groupCount * faktor);
        groupBGCol.G += Convert.ToByte(groupCount * faktor);
        groupBGCol.B += Convert.ToByte(groupCount * faktor);
        e.FontFamily = new FontFamily("Verdana");
        e.Background = groupBGCol;
        e.Height = 30;
    }
    else if (e.Element == ExportElement.GroupHeaderCell &&
        e.Value != null && e.Value.Equals("Chocolade"))
    {
        e.Value = "MyNewValue";
    }
    else if (e.Element == ExportElement.GroupFooterCell)
    {
        GridViewDataColumn column = e.Context as GridViewDataColumn;
        QueryableCollectionViewGroup qcvGroup = e.Value as QueryableCollectionViewGroup;
 
        if (column != null && qcvGroup != null && column.AggregateFunctions.Count() > 0)
        {
            e.Value = GetAggregates(qcvGroup, column);
        }
        else
            e.Value = string.Empty;
    }
    if (e.Value != null)
    {
        DateTime tmp;
        if (DateTime.TryParse(e.Value.ToString(), out tmp))
        {
            e.Value = tmp.ToShortDateString();
        }
 
    }
}

Best regards,
Michael
Deyan
Telerik team
 answered on 05 Aug 2015
2 answers
295 views

Hi,

I have a view with ​two different RadCartesianChart controls, with one scrollbar (on X-axis) for each chart. (see attached image)

I would like to synchronize the scrolling ​between the ​2 charts: for example when I scroll chart​​1, I would also like that in the same time also chart​0 ​is automatically scrolled. ​The two charts have the same settings and values for X axis.

I'm using a solution like the following:

private void SynchronizeChartsPan(object sender, Telerik.Windows.Controls.ChartView.ChartPanOffsetChangedEventArgs e)
{
Chart0.DetailsChart.PanOffsetChanged -= SynchronizeAnalyticDetailsChartsPan;
Chart1.DetailsChart.PanOffsetChanged -= SynchronizeAnalyticDetailsChartsPan;

if (sender != Chart0.DetailsChart) Chart0.DetailsChart.PanOffset = new Point(e.NewPanOffset.X, 0);
if (sender != Chart1.DetailsChart) Chart1.DetailsChart.PanOffset = new Point(e.NewPanOffset.X, 0);


Chart0.DetailsChart.PanOffsetChanged += SynchronizeAnalyticDetailsChartsPan;
Chart1.DetailsChart.PanOffsetChanged += SynchronizeAnalyticDetailsChartsPan;
}

 

The problem with this solution is that the synchronize scrolling does not bring all of the charts at the end at the same time: when I reach the end for chart1, I'm not at the end in the other chart. This seems to be related to a different "PlotAreaClip" in the ​two charts:  Y-Axis have different values and different sizes and this impact on the "PlotAreaClip" size.

What I would expect is that, since I have the same X-Axis in all the charts, when I scroll to the end on X-axis of chart1 I should reach the end also in other chart (regardless of Y-Axis)

How could I get this behaviour?

 Thanks and regards

Alberto
Top achievements
Rank 1
 answered on 05 Aug 2015
3 answers
251 views

Hello, i am using RadCalendar and i have to bind (in two way) multiple selected dates with an observable collection existing in my ​View​Model, the SelectedDate property is currently bound to just one date.

Regards.

Kalin
Telerik team
 answered on 05 Aug 2015
2 answers
121 views

Hello,

 I have combobox with values 0, 1, 2. When user expand the combobox to select the value, I want to show Text of the value as  0 - Bad, 1 - Average, 2 - Good.

 But when user select the value, I want to display the value only.

 How can I do this ?

crazy05
Top achievements
Rank 1
 answered on 04 Aug 2015
1 answer
92 views

I have a Canvas, and its NW and SE corners' Lat-Lon (basically a LocationRect). Is there a way to fix this Canvas to the appropriate locations on the map?

The Canvas will be automatically resized and shifted for any zoom and pan movements on the map control.

Martin Ivanov
Telerik team
 answered on 04 Aug 2015
1 answer
581 views

I am trying to get my AutoCompleteBox to have any other colour than the yellow when mouseover or selecting a dropdown option, as seen in the attached image.

 I'm able to change the textbox colours it self but nothing else.

I need to get this done as soon as possible.

 Please help or can I get an exmaple, any help please and thank you.

 

My code sofar:

    <Style x:Key="RadAutoCompleteBoxItemStyle" TargetType="controls:RadAutoCompleteBoxItem">
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Margin" Value="3 3 0 0"/>
        <Setter Property="Padding" Value="2 0"/>
        <Setter Property="BorderBrush" Value="Black"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="IsTabStop" Value="False"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:RadAutoCompleteBoxItem">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="Border" Storyboard.TargetProperty="Opacity" To="0.6"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="Border" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="Pink" Background="Green">
                            <StackPanel Orientation="Horizontal">
                                <ContentPresenter x:Name="contentPresenter"
                                        Margin="{TemplateBinding Padding}"
                                        HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                        VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                <telerik:RadButton x:Name="RemoveItemButton"
                                        Margin="4 0"
                                        HorizontalAlignment="Right"
                                        VerticalAlignment="Center"
                                        CornerRadius="0"
                                        CommandParameter="{Binding}"
                                        Foreground="{TemplateBinding Foreground}"
                                        Cursor="Arrow"
                                        IsTabStop="False"
                                        Command="{x:Static telerik:RadAutoCompleteBoxCommands.RemoveItem}"
                                        Width="13"
                                        Height="13"
                                        Focusable="False">
                                    <Path Data="M0,0 L5,5 M5,0 L0,5" Stretch="Uniform" HorizontalAlignment="Center" VerticalAlignment="Center" Stroke="Black"/>
                                </telerik:RadButton>
                            </StackPanel>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="RadAutoCompleteTextBoxStyle" TargetType="telerik:RadWatermarkTextBox">
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Margin" Value="3 3 0 0"/>
        <Setter Property="Padding" Value="0"/>
        <Setter Property="BorderBrush" Value="Transparent"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="telerik:RadWatermarkTextBox">
                    <Grid x:Name="RootElement" Cursor="IBeam">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="MouseOverVisual" Storyboard.TargetProperty="Opacity">
                                            <LinearDoubleKeyFrame KeyTime="0:0:0.150" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="MouseOverVisual" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0:0:0.150">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="MouseOverVisual" Storyboard.TargetProperty="Opacity">
                                            <LinearDoubleKeyFrame KeyTime="0:0:0.115" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="MouseOverVisual" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0:0:0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="DisabledVisualElement"/>
                                        <DoubleAnimation Duration="0" To="0.6" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_ContentHost"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="WatermarkStates">
                                <VisualState x:Name="WatermarkHidden">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="WatermarkVisualElement"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="WatermarkVisible"/>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="Border"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                Background="{TemplateBinding Background}"
                                Opacity="1"/>
                        <Border x:Name="MouseOverVisual"
                                Grid.RowSpan="2"
                                Grid.ColumnSpan="2"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                IsHitTestVisible="False"
                                Opacity="0"
                                Visibility="Collapsed"/>
                        <Border x:Name="DisabledVisualElement"
                                BorderBrush="Black"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                Background="{TemplateBinding Background}"
                                IsHitTestVisible="False"
                                Opacity="0"/>
                        <ScrollViewer
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                BorderThickness="0"
                                VerticalScrollBarVisibility="Disabled"
                                HorizontalScrollBarVisibility="Disabled"
                                IsTabStop="False"
                                Padding="{TemplateBinding Padding}"
                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                x:Name="PART_ContentHost"/>
                        <Border x:Name="FocusVisual"
                                Opacity="0"
                                IsHitTestVisible="False"
                                Grid.RowSpan="2"
                                Grid.ColumnSpan="2"
                                BorderBrush="Black"
                                CornerRadius = "2"
                                BorderThickness="1" >
                            <Border BorderBrush="Black" CornerRadius="2" BorderThickness="{TemplateBinding BorderThickness}"/>
                        </Border>
                        <ContentControl x:Name="WatermarkVisualElement"
                                IsTabStop="False"
                                FontStyle="Italic"
                                Opacity="0.5"
                                Content="{TemplateBinding WatermarkContent}"
                                ContentTemplate="{TemplateBinding WatermarkTemplate}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                IsHitTestVisible="False"
                                Margin="{TemplateBinding Padding}"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <ControlTemplate x:Key="RadAutoCompleteBoxTemplate" TargetType="controls:RadAutoCompleteBox">
        <Grid>
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualState x:Name="Normal"/>
                    <VisualState x:Name="MouseOver">
                        <Storyboard>
                            <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="MouseOverVisual"/>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Disabled">
                        <Storyboard>
                            <DoubleAnimation Duration="0" Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="Opacity" To="0.6"/>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
                <VisualStateGroup x:Name="FocusStates">
                    <VisualState x:Name="Unfocused"/>
                    <VisualState x:Name="Focused">
                        <Storyboard>
                            <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="FocusVisual"/>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Border x:Name="Border"
                    BorderBrush="{TemplateBinding BorderBrush}"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    Background="{TemplateBinding Background}"
                    CornerRadius="2"/>
            <Border x:Name="MouseOverVisual"
                    BorderBrush="Black"
                    CornerRadius="2"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    Opacity="0"/>
            <Border x:Name="FocusVisual"
                    Opacity="0"
                    IsHitTestVisible="False"
                    CornerRadius="2"
                    Background="Green"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    BorderBrush="Black">
                <Border BorderBrush="Black" CornerRadius="2" BorderThickness="{TemplateBinding BorderThickness}"/>
            </Border>
            <Border x:Name="DisabledVisualElement"
                    BorderBrush="Black"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    Background="Green"
                    CornerRadius="2"
                    IsHitTestVisible="False"
                    Opacity="0"/>
            <ScrollViewer x:Name="PART_ScrollViewer"
                    Height="{TemplateBinding Height}"
                    VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                    VerticalContentAlignment="Center"
                    BorderThickness="0"
                    Background="Transparent"
                    Padding="0"
                    IsTabStop="False"
                    HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
                    VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
                    Margin="{TemplateBinding BorderThickness}"
                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                <controls:AutoCompleteBoxesItemsControl
                        DisplayMemberPath="{TemplateBinding DisplayMemberPath}"
                        BoxesItemTemplate="{TemplateBinding BoxesItemTemplate}"
                        x:Name="PART_Boxes"
                        IsTabStop="False"
                        Foreground="{TemplateBinding Foreground}"
                        Margin="{TemplateBinding Padding}">
                    <controls:AutoCompleteBoxesItemsControl.ItemsPanel>
                        <ItemsPanelTemplate>
                            <controls:AutoCompleteBoxesWrapPanel Width="{Binding ActualWidth, ElementName=WatermarkTextBox}"/>
                        </ItemsPanelTemplate>
                    </controls:AutoCompleteBoxesItemsControl.ItemsPanel>
                </controls:AutoCompleteBoxesItemsControl>
            </ScrollViewer>
            <Popup x:Name="PART_Popup">
                <Grid x:Name="PopupRoot">
                        <telerik:RadListBox x:Name="PART_ListBox"
                            ItemsSource="{TemplateBinding FilteredItems}"
                            ItemTemplate="{TemplateBinding DropDownItemTemplate}"
                            MinWidth="{TemplateBinding MinDropDownWidth}"
                            MaxHeight="{TemplateBinding MaxDropDownHeight}"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                </Grid>
            </Popup>
        </Grid>
    </ControlTemplate>
    <Style x:Key="RadAutoCompleteBoxStyle" TargetType="controls:RadAutoCompleteBox">
        <Setter Property="IsTabStop" Value="False"/>
        <Setter Property="TextBoxStyle" Value="{StaticResource RadAutoCompleteTextBoxStyle}"/>
        <Setter Property="Template" Value="{StaticResource RadAutoCompleteBoxTemplate}"/>
        <Setter Property="BorderBrush" Value="Black"/>
        <Setter Property="Background" Value="White"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Padding" Value="0 0 3 3"/>
        <Setter Property="Cursor" Value="IBeam"/>
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Disabled"/>
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="Validation.ErrorTemplate" Value="{StaticResource ValidationTooltipTemplate}"/>
    </Style>
    <Style TargetType="controls:RadAutoCompleteBoxItem" BasedOn="{StaticResource RadAutoCompleteBoxItemStyle}"/>
    <Style TargetType="controls:RadAutoCompleteBox" BasedOn="{StaticResource RadAutoCompleteBoxStyle}"/>


    </Window.Resources>



    <Grid>
        <controls:RadAutoCompleteBox x:Name="txtTest" DisplayMemberPath="Companies" SelectionMode="Single" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="24.666,37.999,0,0" Width="214.667" >
        </controls:RadAutoCompleteBox>
    </Grid>​

 

Nasko
Telerik team
 answered on 04 Aug 2015
1 answer
99 views

Dear support,

Can the ScheduleView search for the next available time slots for a new appointment? 

If not, could you suggest the best approach to implement this feature?  How do I test if the time period is available taking into the existing appointments, special slots (non-working hours, public holidays, etc) and the recurrence of appointment and special slots?

Thanks

 

 

Kalin
Telerik team
 answered on 04 Aug 2015
18 answers
398 views
Hi There

I am reading multiple shapefiles in a loop and for each shapefiles I'm creating VirtualizationLayer object and then I'm adding each framework element present in that shapefile to VirtualizationLayer , as shown in below code.

layer = new VirtualizationLayer();
layer.ShapeFill = new MapShapeFill();
 
foreach (FrameworkElement shape in shapes)
{
         layer.Items.Add(shape);
}

1. The issue is few shapefiles are big files and have some 60K+ framework elements and are loading too late.Can't we add shapefile directly to VirtualizationLayer object or any workaround to reduce this time.Is this looping required?Can't we add shapefile directly to layer.In an another open source application we are loading same shapefile without looping the way we are doing in RadMap.

2. For few shapefiles , I have to set shapefill property differently, i.e. ShapeFile.Fill for some shapefiles has to be transparent and for few it has to be filled with color value,similarly ShapeFile.Stroke has to be set differently based on shapefile.The types of shapefiles i have are MapPolyLine etc, The question here is how to know the shapetype of shapefiles, i.e. MapPolyLine. Pointed into Issue no:2 in screenshot.

Cheers
Vishal


Matthes
Top achievements
Rank 1
 answered on 04 Aug 2015
2 answers
219 views

To illustrate MultiSelectComboBox, I am using some forum posted code.

for comboBox i am using

 

<telerik:RadComboBox SelectedIndex="0" x:Name="MembersComboBox"                                    
   ItemsSource="{Binding Members}"
   ItemTemplate="{StaticResource MultiSelectionComboBoxItemTemplate}"
   Visibility="{Binding CanViewOtherUserTrendingConfiguration}"
   SelectionBoxTemplate="{StaticResource MultiSelectionComboBoxSelectionBoxTemplate}"
   ToolTip="{Binding SelectedMembersText}"
   Width="150" Height="20" />
 as i am using MVVM pattern, above comboBox is contained in a user Control RadDocumentPane, and MainChartView userControl DataContext contains the ViewModel

<telerik:RadDocumentPane x:Class="MainChart.MainChartView"
...
>

 and datatemplate MultiSelectionComboBoxSelectionBoxTemplate is defined as

<DataTemplate x:Key="MultiSelectionComboBoxSelectionBoxTemplate">
 <TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType={x:Type telerik:RadDocumentPane}, Mode=FindAncestor}, Path=DataContext.SelectedMembersText}" />
</DataTemplate>

 my question is when i check the checkboxes in the comboBox, it updates the tooltip of combo box, which is bind to viewModel's property SelectedMembersText, but it do not updates the textlbock inside the SelectionBoxTemplate. I am sure i am making some mistake in doing dataBinding. please help me fixing this issue, as i have already applied all possible ways(in my knowledge) of binding textBlock to the field.

 

 

 

 

 

 

 

 

 

1.<telerik:RadComboBox SelectedIndex="0" x:Name="MembersComboBox"                                    
2.                                     ItemsSource="{Binding Members}"
3.                                     ItemTemplate="{StaticResource MultiSelectionComboBoxItemTemplate}"
4.                                  
5.                                     Visibility="{Binding CanViewOtherUserTrendingConfiguration}"
6.                                     SelectionBoxTemplate="{StaticResource MultiSelectionComboBoxSelectionBoxTemplate}"
7.                                     ToolTip="{Binding SelectedMembersText}"
8.                                     Width="150" Height="20" />
1.<telerik:RadComboBox SelectedIndex="0" x:Name="MembersComboBox"                                    
2.                                     ItemsSource="{Binding Members}"
3.                                     ItemTemplate="{StaticResource MultiSelectionComboBoxItemTemplate}"
4.                                  
5.                                     Visibility="{Binding CanViewOtherUserTrendingConfiguration}"
6.                                     SelectionBoxTemplate="{StaticResource MultiSelectionComboBoxSelectionBoxTemplate}"
7.                                     ToolTip="{Binding SelectedMembersText}"
8.                                     Width="150" Height="20" />
Kalin
Telerik team
 answered on 04 Aug 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?