Telerik Forums
UI for WPF Forum
1 answer
138 views
Using the  XmlDataProvider I'm able to bind all the data to the correct elements. Works great in the MainWindow Xaml.  When I Put the TileView control in a page xaml using the same XmlDataProvider I'am able to bind all the elements except the image. I tried using a Imageconverter, but no luck. Is there a trick to get this to bind or I'm missing something?

Any thoughts?

Regards,
Rick

xmlns:local="clr-namespace:Digital_Kitchen_CdrPrint"
<local:ImageConverter x:Key="ImageConverter" />

<Image x:Name="listImg" Source="{Binding XPath=EmpImage, Converter={StaticResource ImageConverter}}"  Stretch="Uniform"/>

 

 

public class ImageConverter : IValueConverter

 

{

 

 

public object Convert(object value, Type targetType, object parameter,

 

CultureInfo culture)

{

String xml =

 

"<Tables>" + "<Table>" + ((XmlElement)value).InnerXml.ToString() + "</Table>" + "</Tables>";

 

XmlDocument XDoc =

 

new XmlDocument();

 

XDoc.LoadXml(xml);

 

 

// XmlNodeList oXmlNode = XDoc.GetElementsByTagName("Station");

 

 

 

//XmlNode node = XDoc.SelectSingleNode("RecipeName");

 

 

XmlNode oXnode = XDoc.SelectSingleNode(

 

"Tables/Table/EmpImage");

 

value = oXnode.LastChild.Value;

BitmapImage image =

 

new BitmapImage();

 

 

 

if (value != null)

 

{

 

 

try

 

{

image.BeginInit();

image.CacheOption = BitmapCacheOption.OnLoad;

image.CreateOptions = BitmapCreateOptions.IgnoreImageCache;

image.UriSource =

 

new Uri((string)value, UriKind.Absolute);

 

image.EndInit();

}

 

 

catch

 

{

image =

 

null;

 

}

}

 

 

return image;

 

}

 

 

public object ConvertBack(object value, Type targetType, object parameter,

 

CultureInfo culture)

{

 

 

throw new Exception("The method or operation is not implemented.");

 

}

}

Kiril Stanoev
Telerik team
 answered on 01 Sep 2010
3 answers
260 views
I was trying to follow along the demo RadControls for WPF -> Data -> GridView -> Appearance -> Custom Row Layout.
I am using a dataset as data source.  It works fine by default but I can't bind to columns after I apply RowStyle property.  I set up a 3 by 2 grid as custom layout and I can see the TextBlocks that are labels.  The TextBlocks that I bind columns do not display data.  Any ideas?

Here is my template
<ControlTemplate x:Key="MyCustomRowTemplate" TargetType="telerik:GridViewRow">
                <Border x:Name="rowsContainer" Background="#FF525252" Padding="8,8,8,0">
                    <Border Background="{StaticResource Office_BlackRowBackground}" x:Name="selectedRow"
                        BorderThickness="1" BorderBrush="#FF000000">
  
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />                                
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
  
                            <TextBlock Text="Code:"
                                       Grid.Column="0" Grid.Row="0"
                                       VerticalAlignment="Top" HorizontalAlignment="Left" 
                                       Foreground="White" FontWeight="Bold" Margin="0,15,15,0" />
  
                            <TextBlock Text="{Binding CD}"
                                       Grid.Column="1" Grid.Row="0"
                                       VerticalAlignment="Top" HorizontalAlignment="Left"
                                       Foreground="White"  Margin="0,15,15,0" />
                              
                            <TextBlock Text="Description:"
                                       Grid.Column="0" Grid.Row="1"
                                       VerticalAlignment="Top" HorizontalAlignment="Left" 
                                       Foreground="White" FontWeight="Bold" Margin="0,15,15,0" />
  
                            <TextBlock Text="{Binding DESC}"  
                                       Grid.Column="1" Grid.Row="1"
                                       VerticalAlignment="Top" HorizontalAlignment="Left"
                                       Foreground="White"  Margin="0,15,15,0" />
                              
                            <TextBlock Text="Enabled:"
                                       Grid.Column="0" Grid.Row="2"
                                       VerticalAlignment="Top" HorizontalAlignment="Left" 
                                       Foreground="White" FontWeight="Bold" Margin="0,15,15,0" />
  
  
                            <TextBlock Text="{Binding ENABLED}"
                                       Grid.Column="1" Grid.Row="2"
                                       VerticalAlignment="Top" HorizontalAlignment="Left"
                                       Foreground="White"  Margin="0,15,15,0" />
  
                        </Grid>
                    </Border>
                </Border>
            </ControlTemplate>

and gridview
<telerik:RadGridView Grid.Row="2" Name="radGridView2" ItemsSource="{Binding}" 
                             Margin="5,5,5,5" HorizontalAlignment="Left" Visibility="Hidden" 
                             IsFilteringAllowed="False" RowSytle="{StaticResource rowStyle}" 
                             ShowGroupPanel="False" ShowColumnHeaders="False"  
                             RowIndicatorVisibility="Collapsed" CanUserReorderColumns="False"  />

Thanks
Kalin Milanov
Telerik team
 answered on 01 Sep 2010
1 answer
95 views

Hi I am using Telerik chart 2010.2.609.35 version.  I am using pie chart. In that the legend items colors are not match with the chart colors .

Here is my sample code to data bind to pie chart

            RadPieChart.DefaultSeriesDefinition = new PieSeriesDefinition();

            RadPieChart.DefaultSeriesDefinition.ItemLabelFormat = "#Y{C0}";

            SeriesMapping seriesMapping = new SeriesMapping();

            seriesMapping.ItemMappings.Add(new ItemMapping("Period", DataPointMember.LegendLabel));

            seriesMapping.ItemMappings.Add(new ItemMapping("Value", DataPointMember.YValue));

            RadPieChart.SeriesMappings.Add(seriesMapping);

            RadPieChart.ItemsSource = datatableARAgeing;

Nikolay
Telerik team
 answered on 01 Sep 2010
1 answer
138 views
Hi

I am trying to implement a custom RadToolBar control using control templating mechanism. I am having trouble with exposing Items property and not able to figure out how to expose it.

Code in Generic.Xaml

<Style TargetType="{x:Type local:TngToolBar}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:TngToolBar}">
                    <ControlsNavigation:RadToolBar Name="PART_BaseControl"
                        DataContext="{TemplateBinding Property=DataContext}"                           
                        ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type local:TngToolBar}},Mode=TwoWay, Path=ItemsSource}"
                          
                        ToolTip="{TemplateBinding Property=ToolTip}"
                        >
                    </ControlsNavigation:RadToolBar>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

Base Class Code:

public class TngBaseTemplateControl : Control
{
    /*
     * Need to get the type of the control template using reflection, on "OnApplyTemplate"
     */
    protected TngBaseTemplateControl()
    {
    }
}


Custom Toolbar Class:

public class TngToolBar : TngBaseTemplateControl 
{
    private Object _itemsSource;
    public override void OnApplyTemplate()
    {
        base.OnApplyTemplate();
        RadToolBar menu = this.Template.FindName("PART_BaseControl", this) as RadToolBar;
    }
    static TngToolBar()
    {
        DefaultStyleKeyProperty.OverrideMetadata(typeof(TngToolBar), new FrameworkPropertyMetadata(typeof(TngToolBar)));
    }
    #region Property: DataContext
    private Object _dataContext;
    public Object DataContext
    {
        get { return GetValue(DataContextProperty); }
        set { SetValue(DataContextProperty, value); }
    }
    public static readonly DependencyProperty DataContextProperty =
        DependencyProperty.Register(
            "DataContext", typeof(Object), typeof(TngToolBar),
             new FrameworkPropertyMetadata
             {
                 PropertyChangedCallback = (obj, e) =>
                 {
                     (obj as TngToolBar).UpdateDataContext((Object)e.NewValue);
                 }
             });
    private void UpdateDataContext(Object sel)
    {
        _dataContext = sel;
    }
    #endregion
    #region Property: ItemsSource
    public Object ItemsSource
    {
        get { return GetValue(ItemsSourceProperty); }
        set { SetValue(ItemsSourceProperty, value); }
    }
    public static readonly DependencyProperty ItemsSourceProperty =
        DependencyProperty.Register(
            "ItemsSource", typeof(Object), typeof(TngToolBar),
            new FrameworkPropertyMetadata
            {
                PropertyChangedCallback = (obj, e) =>
                {
                    (obj as TngToolBar).UpdateItemsSource(e.NewValue);
                }
            });
    private void UpdateItemsSource(Object sel)
    {
        _itemsSource = sel;
    }
    #endregion
                    
}

Viktor Tsvetkov
Telerik team
 answered on 01 Sep 2010
1 answer
130 views
Is it possible to move the zooming/panning control from the bottom middle of the map to the bottom left or bottom right?

Thanks

Chris R.
Andrey
Telerik team
 answered on 01 Sep 2010
1 answer
121 views
Hi,

I need to receive each value changed event on a RadNumerciDown instance. I thought it would be the case with the ValueChanged but this event occurs only when the focus is lost. The key down event doesn't work too...
Thus, I don't know which event I can listen or which method I have to override to get all the internal value changes.
Does anyone know a way to do it?

Thanks in advance
Boyan
Telerik team
 answered on 01 Sep 2010
9 answers
130 views
Hi!

I've a tree(representing a folder/file tree). I want to add a contextMenu only on "Folder" element

On all my "INodeElement", I've a property "IsFolder".

How to do that the contextMenu is only displayed when this property is true?

OR
How to have a different contextMenu depending of this property?

Thank you!
Viktor Tsvetkov
Telerik team
 answered on 01 Sep 2010
3 answers
440 views
Hello,

In all the various examples that I've seen of changing the application theme, when changing the theme from one to the other it will reload the entire application and all default values.  Is there a way to change the application theme without having to do it in the constructor of the app?

For example, in your online demos and local demos after installing the WPF toolkit, there is a drop down box that allows the user to change the theme of the current demo.  If it's the combo box demo, if I change the values of the combo boxes to something else and then change the theme, the default values are selected again and my previous selections are reset.  The same thing happens in the dock manager demo, if I close one or both of the top tabs and then change the theme, the tabs are reloaded.  This appears to be because in all the demos, the themes are set in the constructors, thus changing them would require the constructors to reload which would cause any user input to be completely forgotten.

Is there a way of getting around this?  Or would I be forced to individually change the themes on each individual control instead of the application theme to get what I want?

Thanks,
David
Veselin Vasilev
Telerik team
 answered on 01 Sep 2010
5 answers
189 views
Hi,

I'm using a custom sort algorithm. One of my columns is bound to a property of type object. If I click on the header of this column the SortingStateChanged event is not fired. If I change the type of the property to string, the event is fired.

Is there a way to sort columns bound to a property of type object?

Regards Uli
Maya
Telerik team
 answered on 01 Sep 2010
1 answer
74 views
Hi,

I have a grid bound to a XMLDatasource. The grid is having around 1000 rows and 100 columns. Once we call grid.ItemSource=XMLDataSource, system memory consumption starts increasing. It reaches till 1.5GB and system out of memory exception is throwing. How can we handle this?

Please help.

Thanks and Regards,
Norbert John
Vlad
Telerik team
 answered on 01 Sep 2010
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
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
WatermarkTextBox
DesktopAlert
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
SplashScreen
Rating
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Jesse
Top achievements
Rank 2
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Jesse
Top achievements
Rank 2
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?