Telerik Forums
UI for WPF Forum
2 answers
72 views
xaml:
<RadGrid:RadGridView x:Name="GrdList" AutoGenerateColumns="True" MaxHeight="600" MinWidth="650" BorderThickness="2" ></RadGrid:RadGridView>
code behind:
Public Sub New()
InitializeComponent()
GrdList.ItemsSource = GetXmlData()
End Sub
Private Shared Function GetXmlData() As Object
Dim doc As New XmlDocument()
doc.LoadXml("<?...")
Dim provider As New XmlDataProvider()
provider.IsAsynchronous =
False
provider.Document = doc
provider.XPath =
"Products/Product"
Return New ObservableCollection(Of XmlNode)(DirectCast(provider.Data, IEnumerable(Of XmlNode)))
End Function
throws exception: 'System.Func`2[System.Xml.XmlNode,System.String]' cannot be converted to type 'System.Func`2[System.Xml.XmlElement,System.String]'.
I am using dotnet framework 3.5 and version of rad dll is 2010.3.1314.35.
Afsal
Top achievements
Rank 1
 answered on 10 Feb 2011
6 answers
184 views

Hi.

I is not accustomed to writing in English. Therefore, it can be difficult to read the Thread. Please understand.

RadComboBox and RadTimePicker use, the program being developed, I have a problem.
My program, RadComboBox selection index is used to change the value TimeInterval of RadTimePicker.

XMAL code below, I have been using is normally. Assembly version is the 2010.1.603.35

 

<Window x:Class="TimePicker_Test.Window1"
        xmlns:sys="clr-namespace:System;assembly=mscorlib"
        xmlns:telerikStyle="http://schemas.telerik.com/2008/xaml/presentation"
        xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
        xmlns:telerikPanel="clr-namespace:Telerik.Windows.Controls.Primitives;assembly=Telerik.Windows.Controls"
        xmlns:telerikInput="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Input"
        Title="MainWindow" Height="350" Width="525">
  
    <Window.Resources>
        <ResourceDictionary>
  
            <sys:TimeSpan x:Key="timespan_5min">
                0:5:0
            </sys:TimeSpan>
  
            <sys:TimeSpan x:Key="timespan_hour">
                1:0:0
            </sys:TimeSpan>
  
            <Style x:Key="ui_TimePicker" TargetType="{x:Type telerikInput:RadTimePicker}">
                <Style.Triggers>
  
                    <DataTrigger Binding="{Binding ElementName=ui_RadComboBox, Path=SelectedIndex}" Value="0">
                        <Setter Property="TimeInterval" Value="{StaticResource timespan_5min}" />
                    </DataTrigger>
  
                    <DataTrigger Binding="{Binding ElementName=ui_RadComboBox, Path=SelectedIndex}" Value="1">
                        <Setter Property="TimeInterval" Value="{StaticResource timespan_hour}" />
                    </DataTrigger>
  
                </Style.Triggers>
            </Style>
  
  
            <!--RadTimePicker ScrollBar-->
            <LinearGradientBrush x:Key="HeaderBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
                <GradientStop Color="#FFF8F8F9" Offset="0"/>
                <GradientStop Color="#FFDBDEE1" Offset="1"/>
                <GradientStop Color="#FFDFE2E5" Offset="0.4"/>
                <GradientStop Color="#FFC7CBD1" Offset="0.4"/>
            </LinearGradientBrush>
            <LinearGradientBrush x:Key="BorderOuterColor" EndPoint="0.714,1.292" StartPoint="0.318,0.068">
                <GradientStop Color="#FFdbdcde" Offset="0.39079609253679837" />
                <GradientStop Color="#FFc6c7c8" Offset="1" />
            </LinearGradientBrush>
            <SolidColorBrush x:Key="HeaderForegroundBrush" Color="#FF000000"></SolidColorBrush>
            <SolidColorBrush x:Key="ContentBackgroundBrush" Color="#f0f1f2" />
            <SolidColorBrush x:Key="HeaderBackgroundBrush11" Color="#FFFFFFFF" />
            <Style x:Key="HeaderContentStyle" TargetType="ContentControl">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="ContentControl">
                            <Grid x:Name="RootElement" Margin="0" Background="Transparent">
                                <Rectangle Fill="Transparent" />
                                <ContentPresenter x:Name="buttonContent" HorizontalAlignment="Center"
                                                       Margin="{TemplateBinding Padding}" RenderTransformOrigin="0.5,0.5"
                                                       VerticalAlignment="Center" />
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
  
  
            <Style x:Key="ui_Clock" TargetType="telerikInput:RadClock">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="telerikInput:RadClock">
                            <Border BorderBrush="{TemplateBinding BorderBrush}" 
                                       BorderThickness="{TemplateBinding BorderThickness}" 
                                       Background="{TemplateBinding Background}">
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="30" />
                                        <RowDefinition Height="*" />
                                    </Grid.RowDefinitions>
  
                                    <!--Header background: -->
                                    <Border Background="{StaticResource HeaderBackgroundBrush}" BorderBrush="{StaticResource BorderOuterColor}" BorderThickness="0 0 0 1" >
  
                                        <ContentControl x:Name="button" 
                                                             Content="{TemplateBinding Header}"
                                                             ContentTemplate="{TemplateBinding HeaderTemplate}"
                                                             HorizontalAlignment="Center" Grid.Row="0"
                                                             Foreground="{StaticResource HeaderForegroundBrush}"
                                                             Style="{StaticResource HeaderContentStyle}" />
                                    </Border>
  
                                    <ScrollViewer MaxHeight="200" Grid.Row="1">
                                        <ItemsPresenter x:Name="ItemsPresenter" ></ItemsPresenter>
                                    </ScrollViewer>
  
                                </Grid>
                            </Border>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
                <Setter Property="Header" Value="Clock" />
                <Setter Property="ItemsPanel">
                    <Setter.Value>
                        <ItemsPanelTemplate>
                            <telerikPanel:RadUniformGrid x:Name="uniformGrid" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
                        </ItemsPanelTemplate>
                    </Setter.Value>
                </Setter>
                <Setter Property="ItemTemplate">
                    <Setter.Value>
                        <DataTemplate>
                            <Border x:Name="Borderarea" VerticalAlignment="Center">
                                <TextBlock x:Name="ContentText" TextAlignment="Center"
                                              HorizontalAlignment="Center" VerticalAlignment="Center"
                                              Text="{Binding}" Margin="5 2 5 2" />
                            </Border>
                        </DataTemplate>
                    </Setter.Value>
                </Setter>
                <Setter Property="Background" Value="{StaticResource ContentBackgroundBrush}" />
  
                <Setter Property="Margin" Value="0" />
                <Setter Property="BorderBrush" Value="{StaticResource BorderOuterColor}" />
                <Setter Property="BorderThickness" Value="1" />
                <Setter Property="StartTime" Value="0:0:0" />
                <Setter Property="EndTime" Value="23:59:0" />
                <Setter Property="TimeInterval" Value="1:0:0" />
            </Style>
  
        </ResourceDictionary>
    </Window.Resources>
  
    <Grid>
        <StackPanel>
            <telerikInput:RadComboBox x:Name="ui_RadComboBox"  SelectedIndex="0">
                <telerikInput:RadComboBoxItem Content="5Minute" />
                <telerikInput:RadComboBoxItem Content="Hour" />
            </telerikInput:RadComboBox>
            <telerikInput:RadTimePicker Culture="en-US" Style="{StaticResource ui_TimePicker}" >
            </telerikInput:RadTimePicker>
        </StackPanel>
  
    </Grid>
</Window>

I recently updated to the Assembly version was 2010.2.812.40.
Use this code in the updated version, there is a problem.

First, RadTimePicker Dropdown Item When we do not display properly spaced
This was resolved by specifying ClockSyle. In previous versions, but was not required to specify
<telerikInput:RadTimePicker Culture="en-US" Style="{StaticResource ui_TimePicker}" ClockStyle="{StaticResource ui_Clock}"/>

Second, RadComboBox changes in the selected index when using DataTrigger RadTimePicker tries to change the value of the TimeInterval.

In previous versions of normal, respectively. However, the updated version does not change the value.
Which part is the problem, but I do not know many tests.

To using this code is wrong? Or, there is a problem with the updated version?

I can not find the correct answer, writes Thread.

Wait for an answer. Thanks.
Kang JungSu
Top achievements
Rank 1
 answered on 10 Feb 2011
1 answer
104 views
Hello,
I have  problem with FilteringControl:
I want to limit the size of ListBox with CheckBoxes, I managed to limit the FilteringControl But I failed to limit the
ListBox with CheckBoxes Inside FilteringControl.
Property MaxHeight and MinHeight Working on FilteringControl.
the code:
<Style TargetType="telerik:FilteringControl">
     <Setter Property="MaxHeight" Value="350"/>
     <Setter Property="MaxWidth" Value="300"/>
     <Setter Property="ScrollViewer.IsDeferredScrollingEnabled" Value="true"/>
</Style>
Thanks for your help,
lisa.
Maya
Telerik team
 answered on 10 Feb 2011
2 answers
173 views
First of all, great work on the RadRichTextBox! I'm planning on using the RichTextBox in an application that will share a single RichTextBoxRibbon with several RichTextBoxes. I was wondering what would be the best way to dynamically bind the RichTextBoxRibbon to a specific RichTextBox.

Thanks,

Will
Will Vandergrift
Top achievements
Rank 1
 answered on 09 Feb 2011
2 answers
152 views

I've got a hybrid Chart where the high-level definitions are in XAML, but I build the DataSeries at run-time.  I'm getting a case where I have a Legend on the right, but there are no entries there.  Here's the XAML:

<telerik:RadChart Name="PowerChart" ItemsSource="{Binding}" >
            <telerik:RadChart.DefaultView>
                <telerik:ChartDefaultView>
                    <telerik:ChartDefaultView.ChartArea>
                        <telerik:ChartArea>
                            <telerik:ChartArea.AxisY>
                                <telerik:AxisY Title="Watts"/>
                            </telerik:ChartArea.AxisY>
                            <telerik:ChartArea.AxisX>
                                <telerik:AxisX Title="Time" IsDateTime="True"
                                              Step="5"
                                              LabelStep="1"
                                              DefaultLabelFormat="hh:mm"
                                              StepLabelLevelHeight="10">
                                </telerik:AxisX>
                            </telerik:ChartArea.AxisX>
                        </telerik:ChartArea>
                    </telerik:ChartDefaultView.ChartArea>
                    <telerik:ChartDefaultView.ChartTitle>
                        <telerik:ChartTitle Content="Power"/>
                    </telerik:ChartDefaultView.ChartTitle>
                </telerik:ChartDefaultView>
            </telerik:RadChart.DefaultView>
            <telerik:RadChart.DefaultSeriesDefinition>
                <telerik:StackedBarSeriesDefinition ShowItemLabels="False"/>
            </telerik:RadChart.DefaultSeriesDefinition>
        </telerik:RadChart>

Here's the code-behind that populates the chart via a non-default constructor on a Window:

public PowerChartWindow(DateRangeFilter dateRange, IEnumerable<Circuit> circuitList)
{
    InitializeComponent();
    // Hide the legend and adjust the title if one circuit
    if (circuitList.Count() < 2)
    {
        PowerChart.DefaultView.ChartLegend.Visibility = System.Windows.Visibility.Collapsed;
    }
    else
    {
        PowerChart.DefaultView.ChartLegend.Visibility = System.Windows.Visibility.Visible;
    }
    // Initialize data series
    foreach (Circuit c in circuitList) 
    {
        // Set up the item mappings
        SeriesMapping circuitMapping = new SeriesMapping();
        circuitMapping.ItemMappings.Add(new ItemMapping("Timestamp", DataPointMember.XValue));
        circuitMapping.ItemMappings.Add(new ItemMapping("WattsAllPhases",DataPointMember.YValue));
        circuitMapping.LegendLabel = c.Name;
        circuitMapping.FilterDescriptors.Add(new ChartFilterDescriptor("Circuit.Name", typeof(String), Telerik.Windows.Data.FilterOperator.IsEqualTo, c.Name));
        // Bind the mappings to the series
        PowerChart.SeriesMappings.Add(circuitMapping);
    }
}

Some of the high points:

  • As you see in the XAML, the ItemsMapping is pointed to the DataContext of the Window
  • The DataContext is Collection<LoggedACMeterData>
  • A LoggedACMeter object has, among other properties, a DateTime Timestamp, a double WattsAllPhases, and a Circuit object which has a String Name property.
  • At the moment, the dateRange is ignored.
  • I hand in the IEnumerable<Circuit> to the constructor with the idea of building a DataSeries for each Circuit.
  • To do the above, I use the ChartFilterDescriptor on each DataSeries to only pull records from the DataContext that matches the circuit name.

So the grid is getting set up properly, with the X-Axis correct, ane the Y-Axis labelled properly, and multiple color-coded series.  But the Legend is empty.  Thoughts? 

Attached is a screen shot of what I get.

David Yon

 (on edit: I guess I really mean a SeriesMapping, not a DataSeries as described above)

David
Top achievements
Rank 1
 answered on 09 Feb 2011
4 answers
125 views
Hi!


I'm having my UserControl to show Thumbnails (list of images) using transition control. Image changes one to another every 7 sec. and to achieve this I'm using a Timer. Next is a snipped code:

public partial class ctlPublicidad : UserControl
{
Timer m_objTemporizador = new Timer();
List<string> m_vaThumbNails = new List<string>();
 
public ctlPublicidad()
        {
this.InitializeComponent();
IndiceThumbnailActivo = -1;
}
 
// This is execute when UserControl is loaded
private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
MostrarSiguienteImagenThumbNail();
                                m_objTemporizador = new Timer(7000);
                                m_objTemporizador.Elapsed += new ElapsedEventHandler(Temporizador_Elapsed);
                                m_objTemporizador.Start();
}
 
void Temporizador_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            MostrarSiguienteImagenThumbNail();
        }
 
       private void MostrarSiguienteImagenThumbNail()
        {
            Random vnNumeroRandom = new Random();
            int vnEfecto = vnNumeroRandom.Next(1, 7);
            switch (vnEfecto)
            {
                case 1: TransitionControl.Transition = new MotionBlurredZoomTransition();
                        TransitionControl.Duration = new TimeSpan(0, 0, 0, 0, 400);
                        break;
                case 2: TransitionControl.Transition = new FadeTransition();
                        TransitionControl.Duration = new TimeSpan(0, 0, 0, 0, 750);
                        break;
                case 3: TransitionControl.Transition = new LinearFadeTransition() { Angle = 0.3, Darker = 0.3, Thickness = 0.2 };
                        TransitionControl.Duration = new TimeSpan(0, 0, 0, 0, 750);
                        break;
                case 4: TransitionControl.Transition = new WaveTransition() { Angle = 0.5, Amplitude = 0.15 };
                        TransitionControl.Duration = new TimeSpan(0, 0, 0, 0, 750);
                        break;
                case 5: TransitionControl.Transition = new FlipWarpTransition();
                        TransitionControl.Duration = new TimeSpan(0, 0, 0, 0, 750);
                        break;
                case 6: TransitionControl.Transition = new SlideAndZoomTransition();
                        TransitionControl.Duration = new TimeSpan(0, 0, 0, 0, 750);
                        break;
                case 7: TransitionControl.Transition = new RollTransition();
                        TransitionControl.Duration = new TimeSpan(0, 0, 0, 0, 750);
                        break;
            }
 
            TransitionControl.Content = new Image() { Source = new BitmapImage(new Uri(m_vaThumbNails[++IndiceThumbnailActivo], UriKind.RelativeOrAbsolute)) };
        }
}

First image is showed fine, but when timer elapsed is reached, exception is thrown when try to change to another transition effect. Error is:
"The calling thread can not access this object because the owner is another thread". How can I do to achieve this thumbnail???


thanks
ENTERPRISE INTERNATIONAL SAS
Top achievements
Rank 1
 answered on 09 Feb 2011
2 answers
87 views
Hi all

I want to make an editable grid in Row Details Template.. What I did is that from a Linq Query i fill the observable collection and bind the outer grid with it.. The outer grid shows the data in the grid.. Now when I select a row I want to open a new grid based on the selected row.. How will i do that also i want editable fields in this inner grid.. When i code this it throws an exception saying that as the data in the grid is from a linq query and the properties in linq query are readonly so they can not be edited.. I am very confused due to this.. Help me in solving this issue..

P.S> My linq query uses 3 to 4 joins.

 
Zeeshan
Top achievements
Rank 1
 answered on 09 Feb 2011
1 answer
572 views
I created custom column;
It works fine but when I am trying to clear a cell I am geting "Value Cannot be converted" validation error.
My binding is to the nullable double.
Please advise what to do.

thanks

  public class NumericTextBoxColumn :GridViewBoundColumnBase
    {
        public override FrameworkElement CreateCellEditElement(GridViewCell cell, object dataItem)
        {
            this.BindingTarget = NumericTextBox.TextProperty;
            NumericTextBox control = new NumericTextBox();
            control.SetBinding(this.BindingTarget, this.CreateValueBinding());
            return control;
        }

        private Binding CreateValueBinding()
        {
            Binding valueBinding = new Binding();
            valueBinding.Mode = BindingMode.TwoWay;
            valueBinding.NotifyOnValidationError = true;
            valueBinding.ValidatesOnExceptions = true;
            valueBinding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
            valueBinding.Path = new PropertyPath(this.DataMemberBinding.Path.Path);

            return valueBinding;
        }
    }


where;

   public class NumericTextBox: TextBox
    {
       
        protected override void OnPreviewTextInput(System.Windows.Input.TextCompositionEventArgs e)
        {
            if(string.IsNullOrEmpty(e.Text))
            {
                e.Handled = true;
                return;
            }
           
            e.Handled = !AreAllValidNumericChars(e.Text);
            base.OnPreviewTextInput(e);
        }

        private bool AreAllValidNumericChars(string str)
        {
            foreach (char c in str)
            {
                if (c == '.' && base.Text.Contains(".")) return false;
                if (!(Char.IsNumber(c) || c=='.' )) return false;
            }

            return true;
        }

    }

Maya
Telerik team
 answered on 09 Feb 2011
1 answer
367 views
Hi,

How can i route the DropDownOpened event raised by the RadComboBox to a handler in the viewmodel?

Thanks.
George
Telerik team
 answered on 09 Feb 2011
1 answer
110 views
I have a RadDocking with two RadSplitContainers in it. In the first Container I have one Pane and in the second Container I have a DocumentHost with n Panes. How do I prevent the Panes from the DocumentHost from docking in the first RadSplitContainer (or force them to only dock in their "own" SplitContainer)?

My structure looks like this:

<telerik:RadDocking>
    <!-- Panel -->
    <telerik:RadSplitContainer MinWidth="265" MaxWidth="600" Width="350" Name="LeftContainer" InitialPosition="DockedLeft" Margin="0,-4,0,0">
        <telerik:RadPaneGroup BorderThickness="1">
            <telerik:RadPane Header="Title">
                Content
            </telerik:RadPane>
        </telerik:RadPaneGroup>
    </telerik:RadSplitContainer>
     
    <!-- Tabs -->
    <telerik:RadDocking.DocumentHost>
        <telerik:RadSplitContainer Margin="0,-3,0,0" BorderThickness="1">
            <telerik:RadPaneGroup>
                <telerik:RadPane Header="asdf">
                    aasdf asdf
                </telerik:RadPane>
                <telerik:RadPane Header="asdf">
                    aasdf asdf
                </telerik:RadPane>
            </telerik:RadPaneGroup>
        </telerik:RadSplitContainer>
    </telerik:RadDocking.DocumentHost>
</telerik:RadDocking>
Konstantina
Telerik team
 answered on 09 Feb 2011
Narrow your results
Selected tags
Tags
GridView
General Discussions
Chart
RichTextBox
Docking
ScheduleView
ChartView
TreeView
Diagram
Map
ComboBox
TreeListView
Window
RibbonView and RibbonWindow
PropertyGrid
DragAndDrop
TabControl
TileView
Carousel
DataForm
PDFViewer
MaskedInput (Numeric, DateTime, Text, Currency)
AutoCompleteBox
DatePicker
Buttons
ListBox
GanttView
PivotGrid
Spreadsheet
Gauges
NumericUpDown
PanelBar
DateTimePicker
DataFilter
Menu
ContextMenu
TimeLine
Calendar
Installer and Visual Studio Extensions
ImageEditor
BusyIndicator
Expander
Slider
TileList
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
Book
FileDialogs
ToolBar
ColorPicker
TimePicker
SyntaxEditor
MultiColumnComboBox
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
DesktopAlert
WatermarkTextBox
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
ProgressBar
Sparkline
LayoutControl
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
Licensing
WebCam
CardView
DataBar
FilePathPicker
PasswordBox
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
VirtualKeyboard
HighlightTextBlock
Security
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?