Telerik Forums
UI for WPF Forum
3 answers
180 views
Hi,

I've been experimenting a little with the PersistenceFramework over the course of the day and I've found some, according to me,
mystic behaviour.

When the window containing my RadGridView closes I run this code:
var manager = new PersistenceManager();
var stream = manager.Save(dgOrderOverview);
 
using (var fileStream = File.Create(System.AppDomain.CurrentDomain.BaseDirectory + "\\objstore.hf"))
{
    stream.CopyTo(fileStream);
}

and when I open it up again the following code is run:
//Check if any persistence file exists, and if so, load the view
if (File.Exists(System.AppDomain.CurrentDomain.BaseDirectory + "\\objstore.hf"))
{
    var manager = new PersistenceManager();
 
    try
    {
        var fileStream = File.OpenRead(System.AppDomain.CurrentDomain.BaseDirectory + "\\objstore.hf");
        manager.Load(dgOrderOverview, fileStream);
        fileStream.Close();
    }
    catch (Exception ex)
    {
        System.Diagnostics.Debug.WriteLine(ex.Message, "MYAPPNAME");
    }
}
 
//Load Context Menu
RadContextMenu ctxMenu = new RadContextMenu();
RadMenuItem item = new RadMenuItem();
 
foreach (Telerik.Windows.Controls.GridViewColumn column in dgOrderOverview.Columns)
{
    RadMenuItem sitem = new RadMenuItem() { Header = column.Header, IsCheckable = true, IsChecked = true };
    sitem.SetBinding(RadMenuItem.IsCheckedProperty, new Binding("IsVisible") { Mode = BindingMode.TwoWay, Source = column });
    ctxMenu.Items.Add(sitem);
}
 
RadContextMenu.SetContextMenu(dgOrderOverview, ctxMenu);

For the sake of things it should be noted that I have a RadContextMenu loading in order to be able to show/hide columns in the RadGridView.

Now, here's to the tricky bit, I have a RadContextMenu where the user can set the visibility of the columns, and IF the user ONLY uses this, everything is fine and dandy, visibility properties as set as they should upon reload. However IF the user decides to rearrange the columns, the next time he/she opens up the window, ALL columns are gone, there's NOTHING there at all.

So in short:
* Show / Hide columns using the RadContextMenu bound to the RadGridView works fine, persistence is kept and loads nicely.
* Rearrange columns and the persistence is broken and no columns as viewable upon opening the window.

As a little twist, the columns are all visible in the ContextMenu and their visibility are set as they should, but the GridView doesn't display them.

A little help, please?

P.S
I run the following version of the Telerik components:
RadControls_for_WPF_2013_1_0527_DEV_hotfix
D.S
Johannes
Top achievements
Rank 1
 answered on 14 Jun 2013
1 answer
63 views
Hi,

Demo 2013 Q2 Final Issue Style Changing Touch Demo to Default, This Issue does not exist Demo 2013 Q2 Beta, Please see screenshot.
OS : Windows 8 x64

Thanks.
Stanislav
Telerik team
 answered on 14 Jun 2013
2 answers
264 views
Hi,

I'm Synchronization RadListbox and RadDataForm SelectedItem 0 not highlight i'm trying MS ListBox not problem.

Thanks.
<telerik:RadDataForm x:Name="dataForm" ItemsSource="{Binding Items}"/>
<telerik:RadListBox x:Name="ListBox" ItemsSource="{Binding Items}" SelectedIndex="0" />
 
  
 
        private ICollectionView _items;
        public ICollectionView Items
        {
            get
            {
                if (_items== null)
                {                   
                   Items = new QueryableCollectionView(new ObservableCollection<Contact>(RepositoryBase.Context.Contacts));
                }
                return _items;
            }
            set
            {
                if (Equals(value, _items)) return;
                _items= value;
                NotifyOfPropertyChange(() => Items);
            }
        }
Steve
Top achievements
Rank 1
 answered on 14 Jun 2013
1 answer
120 views
Hello,
Is it possible to scroll panels automatically ? I mean, for example, it changes panel every 10 seconds.

Thanks.
Pavel R. Pavlov
Telerik team
 answered on 14 Jun 2013
6 answers
437 views
Hi,

Is it possible to select the row in a grid when a context menu is opened by right clicking on that row?
Maya
Telerik team
 answered on 14 Jun 2013
2 answers
82 views
Hi,

I'm trying to figure out how to have individual RadPanelBarItems have their background colors changed when a user tabs through the RadPanelBar.  Currently when a user selects (left mouse click) a specific RadPanelBarItem, the color changes to orange (the default color); I want to be able to do the same if the user tabs to the item as well. The usage of IsTabStop and TabStop does not seem to work; I could perhaps be setting it incorrectly.   The following is a code snippet of xaml implementation:


 <telerikNavigation:RadPanelBar IsTabStop="True" Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" VerticalAlignment="Stretch" x:Name="SummaryMenu" HorizontalAlignment="Stretch" Margin="0,-1,0,-1">

                    <telerikNavigation:RadPanelBar.Background>
                        <ImageBrush ImageSource="pack://application:,,,/Resources/Images/Left-Menu-Back.png" />
                    </telerikNavigation:RadPanelBar.Background>


                    <telerikNavigation:RadPanelBarItem IsExpanded="True" IsTabStop="True" BorderThickness="0">
                            <telerikNavigation:RadPanelBarItem.Header>
                                <TextBlock Text="VIEWS" Style="{StaticResource SmallMenuHeaderIconLabel}" />
                            </telerikNavigation:RadPanelBarItem.Header>

                        <telerikNavigation:RadPanelBarItem IsTabStop="True" TabIndex="1"  MouseLeftButtonDown="SummaryMenuDockingItemLeftButtonDownClick" MouseLeftButtonUp="SummaryMenuDockingItemLeftButtonUpClick" Keyboard.KeyUp="OnKeyPressEnterViewsMenuItem" Tag="MainViewLogicalConfiguration" IsSelected="True">
                                <telerikNavigation:RadPanelBarItem.Header>
                                    <StackPanel Orientation="Vertical">
                                        <Image Source="/Resources/Images/MenuIcons/MainView.png" ToolTip="Main" Style="{StaticResource SmallMenuIcon}"/>
                                        <TextBlock Text="Main" Style="{StaticResource SmallMenuIconLabel}" />
                                    </StackPanel>
                                </telerikNavigation:RadPanelBarItem.Header>
                            </telerikNavigation:RadPanelBarItem>

                        <telerikNavigation:RadPanelBarItem IsTabStop="True" TabIndex="2" MouseLeftButtonDown="SummaryMenuDockingItemLeftButtonDownClick" MouseLeftButtonUp="SummaryMenuDockingItemLeftButtonUpClick" Keyboard.KeyUp="OnKeyPressEnterViewsMenuItem" Tag="PhysicalLayout" >
                                <telerikNavigation:RadPanelBarItem.Header>
                                    <StackPanel Orientation="Vertical">
                                        <Image Source="/Resources/Images/MenuIcons/Physical-Configuration.png" ToolTip="Physical Configuration" Style="{StaticResource SmallMenuIcon}"/>
                                        <TextBlock Text="Physical Configuration" Style="{StaticResource SmallMenuIconLabel}" />
                                    </StackPanel>
                                </telerikNavigation:RadPanelBarItem.Header>
                            </telerikNavigation:RadPanelBarItem>
                        ......
                        ......
               </<telerikNavigation:RadPanelBar>

Thanks for the help,
Robert Quan
Robert
Top achievements
Rank 1
 answered on 13 Jun 2013
2 answers
145 views
Hi ,
When I bind a object in propertygrid like a

PsPropertyGrid1.SelectedObject = MachineConfig
I want to change Category name at runtime for localization

I can change Item name and description with ItemFormatting event as fallow but Categoty property is readonly ,
How can I change category attirubute name at runtime in radpropertygrid... 

Private Sub PsPropertyGrid1_ItemFormatting(sender As Object, e As Telerik.WinControls.UI.PropertyGridItemFormattingEventArgs) Handles PsPropertyGrid1.ItemFormatting
            Select Case e.Item.Name
                Case Is = "MachineID"
                    'e.Item.Enabled = False
                    e.Item.Label = RM.GetString(7760)
                    e.Item.Description = RM.GetString(7761)

                Case Is = "CompanyInfo"
 .....
 .....

            End Select
Sub

Thanks for all helps...

Hakan
Top achievements
Rank 1
 answered on 13 Jun 2013
1 answer
167 views
Hi

I'm dynamically adding data into a timeline, everytime I add a data, I set the PeriodEnd property of the timeline control to the max time in the dataset. I like the TimeLine control to be zoomed out to the maximum when a new data is added, how do I achieve that ? I tried setting VisiblePeroidStart and End to PeroidStart and End but that doesn't work.

Any ideas ?

Thanks, Dave
Petar Kirov
Telerik team
 answered on 13 Jun 2013
2 answers
72 views
Hi there,

I have console application is being launched from the WPF application, and it has been running fine all the time, right after I install 2013Q1, the output (Console.WriteLine) disappeared from the console windows, and only be shown in the output window in visual studio, I double check this behavior from source control as well.

Dimitrina
Telerik team
 answered on 13 Jun 2013
3 answers
128 views
Hi Telerik

I have defined a tileview using a data template and a radfluidcontentcontrol. The small content definition includes a button which initiates some data fetches in order to create a view which is then placed in a binding in the largecontent template. I want to be able to bind the maximizing of a particular tile to the IsVisibleChanged event on a textblock in the small content template for that tile. (The text block is made visible once the view to be placed in the large content has been created). The approach I have attempted (see below) works for the first tile I try but fails after that. Can you have a look and tell me where I am going wrong please?

Many thanks in advance

Regards
Ian Carson

XAML
             x:Class="Bambi.Modules.Dashboards.Views.StrategySummaryView"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:local="clr-namespace:Bambi.Modules.Dashboards"
             xmlns:controls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"
             xmlns:inf="clr-namespace:Bambi.Infrastructure;assembly=Bambi.Infrastructure"
             mc:Ignorable="d"
             d:DesignHeight="300" d:DesignWidth="300"
             Name="Strategy">
    <UserControl.Resources>
        <inf:InvertBoolean x:Key="InvertBoolean"/>
        <inf:BooleanToVisibility x:Key="BooleanToVisibility"/>
        <inf:InvertBooleanToVisibility x:Key="InvertBooleanToVisibility"/>
        <DataTemplate x:Key="HeaderTemplate">
            <TextBlock Text="{Binding StrategyName}" FontFamily="Helvetica Neue LT Com" FontSize="14"/>
        </DataTemplate>
        <DataTemplate x:Key="DailyDataTemplate">
            <telerik:RadFluidContentControl ContentChangeMode="Manual" TransitionDuration="0:0:0.5">
                <telerik:RadFluidContentControl.LargeContent>
                    <ContentPresenter Content="{Binding StrategyDetail}"/> <--This is the created view
                </telerik:RadFluidContentControl.LargeContent>
                <telerik:RadFluidContentControl.SmallContent>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="150"/>
                            <ColumnDefinition Width="150"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="0.17*"/>
                            <RowDefinition Height="0.17*"/>
                            <RowDefinition Height="0.17*"/>
                            <RowDefinition Height="0.17*"/>
                            <RowDefinition Height="0.1*"/>
                            <RowDefinition Height="0.13*"/>
                        </Grid.RowDefinitions>
                        <TextBlock FontFamily="Helvetica Neue LT Com" FontSize="32" Foreground="#FFF39200" VerticalAlignment="Bottom" Margin="0,15,0,0" HorizontalAlignment="Right"><Run Language="en-au" Text="{Binding TradeCount }"/></TextBlock>
                        <TextBlock Grid.Column="1" Margin="8,0,32,0" FontFamily="Helvetica Neue LT Com" Foreground="Gray" FontWeight="Bold" Height="20" VerticalAlignment="Bottom" FontSize="12"><Run Language="en-au" Text="TRADES"/></TextBlock>
                        <TextBlock FontFamily="Helvetica Neue LT Com" FontSize="32" VerticalAlignment="Bottom" Foreground="#FFF39200" Margin="0,15,0,0" HorizontalAlignment="Right" Grid.Row="1"><Run Language="en-au" Text="{Binding Return, StringFormat={}{0:P} }"/></TextBlock>
                        <TextBlock Grid.Column="1" Margin="8,0,32,0" TextWrapping="Wrap" FontFamily="Helvetica Neue LT Com" Foreground="Gray" FontWeight="Bold" Height="20" VerticalAlignment="Bottom" FontSize="12" Grid.Row="1"><Run Language="en-au" Text="RETURN"/></TextBlock>
                        <TextBlock FontFamily="Helvetica Neue LT Com" FontSize="32" VerticalAlignment="Bottom" Foreground="#FFF39200" Margin="0,15,0,0" HorizontalAlignment="Right" Grid.Row="2"><Run Language="en-au" Text="{Binding Probability, StringFormat={}{0:P} }"/></TextBlock>
                        <TextBlock Grid.Column="1" Margin="8,0" TextWrapping="Wrap" FontFamily="Helvetica Neue LT Com" Foreground="Gray" FontWeight="Bold" Height="20" VerticalAlignment="Bottom" FontSize="12" Grid.Row="2"><Run Language="en-au" Text="PROBABILITY"/></TextBlock>
                        <TextBlock FontFamily="Helvetica Neue LT Com" FontSize="32" VerticalAlignment="Bottom" Foreground="#FFF39200" Margin="0,15,0,0" HorizontalAlignment="Right" Grid.Row="3"><Run Language="en-au" Text="{Binding WinLossRatio, StringFormat={}{0:P} }"/></TextBlock>
                        <TextBlock Grid.Column="1" Margin="8,0" TextWrapping="Wrap" FontFamily="Helvetica Neue LT Com" Foreground="Gray" FontWeight="Bold" Height="20" VerticalAlignment="Bottom" FontSize="12" Grid.Row="3"><Run Language="en-au" Text="WIN/LOSS"/></TextBlock>
                        <telerik:RadRating IsReadOnly="False" NumberOfItemsToGenerate="10" Grid.ColumnSpan="2" HorizontalAlignment="Center" Grid.Row="4" Value= "{Binding Ranking}" Margin="0,0,5,5" VerticalAlignment="Bottom"/>
                        <telerik:RadButton Visibility="{Binding RetrievePressed, Converter={StaticResource InvertBooleanToVisibility}}" Content="Retrieve Details" Grid.Row="5" Grid.ColumnSpan="2" telerik:StyleManager.Theme="Expression_Dark" VerticalAlignment="Center" Height="24" Width="150" Command="{Binding DataContext.RetrieveStrategyDetailCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:RadTileView}} }" CommandParameter="{Binding TrackingID}" />
                        <telerik:RadProgressBar
                            telerik:StyleManager.Theme="Expression_Dark"
                            Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="2" Height="6" Width="150"
                            VerticalAlignment="Center" HorizontalAlignment="Center"
                            IsIndeterminate="True"
                            DataContext="{Binding}"
                            Visibility="{Binding VisibleProgressBar, Converter={StaticResource BooleanToVisibility}}"/>
                        <TextBlock
                            Visibility="{Binding DataComplete, Converter={StaticResource BooleanToVisibility}}"
                            Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="2"
                            TextWrapping="Wrap" FontFamily="Helvetica Neue LT Com" Foreground="Gray" FontWeight="Bold" Height="20"
                            VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="12"
                            IsVisibleChanged="TextBlock_IsVisibleChanged">
                            <Run Language="en-au" Text="COMPLETE"/>
                        </TextBlock>
                    </Grid>
                </telerik:RadFluidContentControl.SmallContent>
            </telerik:RadFluidContentControl>
        </DataTemplate>
        <DataTemplate x:Key="HourlyDataTemplate">
            <telerik:RadFluidContentControl ContentChangeMode="Manual" TransitionDuration="0:0:0.5" >
                <telerik:RadFluidContentControl.LargeContent>
                    <Grid Margin="0">
                        <Rectangle Fill="Aqua"  Margin="0"/>
                        <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Black"  Text="LargeContent" FontSize="24"/>
                    </Grid>
                </telerik:RadFluidContentControl.LargeContent>
                <telerik:RadFluidContentControl.SmallContent>
                    <Grid Margin="0">
                        <Rectangle Fill="BlueViolet"  Margin="0"/>
                        <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Yellow"  Text="SmallContent" FontSize="24"/>
                    </Grid>
                </telerik:RadFluidContentControl.SmallContent>
            </telerik:RadFluidContentControl>
        </DataTemplate>
        <DataTemplate x:Key="MinutelyDataTemplate">
            <telerik:RadFluidContentControl ContentChangeMode="Manual" TransitionDuration="0:0:0.5" >
                <telerik:RadFluidContentControl.LargeContent>
                    <Grid Margin="0">
                        <Rectangle Fill="Tomato"  Margin="0"/>
                        <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="SteelBlue" Text="LargeContent" FontSize="24"/>
                    </Grid>
                </telerik:RadFluidContentControl.LargeContent>
                <telerik:RadFluidContentControl.SmallContent>
                    <Grid Margin="0">
                        <Rectangle Fill="Silver"  Margin="0"/>
                        <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Sienna"  Text="SmallContent" FontSize="24"/>
                    </Grid>
                </telerik:RadFluidContentControl.SmallContent>
            </telerik:RadFluidContentControl>
        </DataTemplate>
        <local:StrategyTemplateSelector x:Key="ContentDataTemplateSelector"
                                       DailyDataTemplate="{StaticResource DailyDataTemplate}"
                                       HourlyDataTemplate="{StaticResource HourlyDataTemplate}"
                                       MinutelyDataTemplate="{StaticResource MinutelyDataTemplate}"/>
    </UserControl.Resources>
    <Grid Background="#FF252929">
        <Grid.RowDefinitions>
            <RowDefinition Height="30" />
            <RowDefinition Height="274*" />
        </Grid.RowDefinitions>
        <controls:RadTileView Name="StrategiesTiles"
                             telerik:StyleManager.Theme="Expression_Dark"
                             MinimizedColumnWidth="300"
                             MinimizedRowHeight="300"
                             MaximizeMode="One"
                             PreservePositionWhenMaximized="True"
                             ContentTemplateSelector="{StaticResource ContentDataTemplateSelector}"
                             ItemsSource="{Binding StrategyDetails}"
                             ItemTemplate="{StaticResource HeaderTemplate}"
                             TileStateChanged="RadTileView_TileStateChanged"
                             TileStateChangeTrigger="SingleClick"
                             Loaded="StrategiesTiles_Loaded"
                             Grid.Row="0" Grid.RowSpan="2" DataContext="{Binding}"
                             >
        </controls:RadTileView>
    </Grid>
</UserControl>


Code Behind
/// <summary>
/// Interaction logic for DashboardView.xaml
/// </summary>
public partial class StrategySummaryView
{
    public StrategySummaryView()
    {
        InitializeComponent();
    }
 
    public StrategySummaryView(StrategySummaryViewModel viewModel)
        : this()
    {
        DataContext = viewModel;
    }
 
    private void RadTileView_TileStateChanged(object sender, Telerik.Windows.RadRoutedEventArgs e)
    {
        var item = e.OriginalSource as RadTileViewItem;
 
        if (item != null)
        {
            var fluid = item.ChildrenOfType<RadFluidContentControl>().FirstOrDefault();
            if (fluid != null)
            {
                switch (item.TileState)
                {
                    case TileViewItemState.Maximized:
                        fluid.State = FluidContentControlState.Large;
                        break;
                    case TileViewItemState.Minimized:
                        fluid.State = FluidContentControlState.Small;
                        break;
                }
            }
        }
    }
 
    private void StrategiesTiles_Loaded(object sender, RoutedEventArgs e)
    {
        foreach (var tile in StrategiesTiles.ChildrenOfType<RadTileViewItem>())
        {
            var fluid = tile.ChildrenOfType<RadFluidContentControl>().FirstOrDefault();
            if (fluid != null)
            {
                switch (tile.TileState)
                {
                    case TileViewItemState.Maximized:
                        fluid.State = FluidContentControlState.Large;
                        break;
                    case TileViewItemState.Minimized:
                        fluid.State = FluidContentControlState.Small;
                        break;
                }
            }
        }
    }
 
    private void TextBlock_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
    {
        if ((bool)e.NewValue != true) return;
         
        var textBlock = sender as FrameworkElement;
        if (textBlock == null) return;
 
        var container = textBlock.ParentOfType<RadTileViewItem>();
        if (container == null) return;
 
        container.TileState = TileViewItemState.Maximized;
    }
}


Zarko
Telerik team
 answered on 13 Jun 2013
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
LayoutControl
ProgressBar
Sparkline
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
Callout
Rating
Accessibility
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?