Telerik Forums
UI for WPF Forum
4 answers
153 views
Hello!
I'm sorry for my english ;)

I want to download images in a grid from a database, edit them and save the result back to base.

I have a database (SQLite) that has a table with images.

I use the grid as follows:
<Window.Resources>
        <my:GoodsInStoreDataSet x:Key="dsMy" />
        <CollectionViewSource x:Key="vs_t_test" Source="{Binding Path=t_test, Source={StaticResource dsMy}}" />
</Window.Resources>
<Grid DataContext="{StaticResource vs_t_test}">
        <telerik:RadGridView ItemsSource="{Binding}" Name="rdGrid" AutoGenerateColumns="False"   MouseDoubleClick="rdGrid_MouseDoubleClick">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding ID}" Header="ID"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding NOTE}" Header="Note"/>
                <telerik:GridViewImageColumn DataMemberBinding="{Binding Picture}" Header="Pic" MinWidth="100" ImageStretch="Fill" MaxWidth="100"/>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
</Grid>

Code when loading windows

private void Window_Loaded(object sender, RoutedEventArgs e)
{
    GoodsInStore.GoodsInStoreDataSet dsGIS = ((GoodsInStore.GoodsInStoreDataSet)(this.FindResource("dsMy")));
 
    GoodsInStore.GoodsInStoreDataSetTableAdapters.t_testTableAdapter ta_t_test = new GoodsInStore.GoodsInStoreDataSetTableAdapters.t_testTableAdapter();
    ta_t_test.Fill(dsGIS.t_test);
    System.Windows.Data.CollectionViewSource vs_t_test = ((System.Windows.Data.CollectionViewSource)(this.FindResource("vs_t_test")));
    vs_t_test.View.MoveCurrentToFirst();        
 
}

When the window boot - displays a grid with pictures. All works well.
I can make changes in the "Note" and save the changes to the database.

Saving changes is as follows:
private void  SaveButton_Click(object sender, RoutedEventArgs e)
{
    GoodsInStore.GoodsInStoreDataSet dsGIS = ((GoodsInStore.GoodsInStoreDataSet)(this.FindResource("dsMy"))); 
    GoodsInStore.GoodsInStoreDataSetTableAdapters.t_testTableAdapter ta_t_test = new GoodsInStore.GoodsInStoreDataSetTableAdapters.t_testTableAdapter();
    ta_t_test.Update(dsGIS.t_test);
}

I'm trying to change the picture in the grid as follows:

private void OnCellDoubleClick(object sender, RadRoutedEventArgs args)
{
    GridViewCellBase cell = args.OriginalSource as GridViewCellBase;
    if (cell != null && cell.Column.UniqueName == "Picture")
    {
        Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
        dlg.DefaultExt = ".jpg";
        dlg.Filter = "Jpeg pictures (.jpg)|*.jpg";
        Nullable<bool> result = dlg.ShowDialog();
 
        if (result == true)
        {
            string filename = dlg.FileName;
            BitmapImage myBitmapImage = new BitmapImage();
 
            myBitmapImage.BeginInit();
            myBitmapImage.UriSource = new Uri(filename, UriKind.RelativeOrAbsolute);
            myBitmapImage.EndInit();
 
            rdGrid.CurrentCell.Value =  myBitmapImage;
        }               
    
}

No changes (not in the grid, not in the database) does not occur. The grid displays the old picture.

Tell me what am I doing wrong?
How to change the image with the grid and in the database?

Гоша
Top achievements
Rank 1
 answered on 04 Nov 2010
1 answer
70 views
Having this style defined in app.xaml...

<Style TargetType="Grid">
    <Setter Property="Background" Value="#00000000" />
</Style>

.. breaks the TreeListView expand/collapse behaviour.  This breaks regardless of the value of the Background.  This was an extremely time consuming and frustrating bug to track down.


Full sample:

MainWindow.xaml
<Window x:Class="TreeListViewExample.MainWindow"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Controls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView" Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Controls:RadTreeListView ItemsSource="{Binding Items}" AutoGenerateColumns="False">
            <Controls:RadTreeListView.ChildTableDefinitions>
                <Controls:TreeListViewTableDefinition ItemsSource="{Binding Children}"/>
            </Controls:RadTreeListView.ChildTableDefinitions>
            <Controls:RadTreeListView.Columns>
                <Controls:GridViewDataColumn Header="Test" DataMemberBinding="{Binding Text}"/>
            </Controls:RadTreeListView.Columns>
        </Controls:RadTreeListView>
    </Grid>
</Window>

App.xaml
<Application x:Class="TreeListViewExample.App"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             StartupUri="MainWindow.xaml">
    <Application.Resources>
        <Style TargetType="Grid">
            <Setter Property="Background" Value="Green"/>
        </Style>
    </Application.Resources>
</Application>


Codebehind:
public partial class MainWindow : Window
{
   public MainWindow()
   {
      InitializeComponent();
      DataContext = this;
 
      Items = new ObservableCollection<TestClass>();
      var child3 = new TestClass {Text = "child 3"};
      var child2 = new TestClass {Text = "child 2", Children = new[] {child3}};
 
      var child = new TestClass {Text = "child", Children = new[] {child2}};
      Items.Add(child);
   }
 
   public ObservableCollection<TestClass> Items { get; private set; }
}
 
public class TestClass
{
   public string Text { get; set; }
   public IEnumerable<TestClass> Children { get; set; }
}


Cheers,

Andy
Vanya Pavlova
Telerik team
 answered on 04 Nov 2010
1 answer
142 views
How do you change the time slot template in the ScheduleView? In the Scheduler you would use the TimeSlotTemplateSelector.
Pana
Telerik team
 answered on 04 Nov 2010
4 answers
174 views
Hello team and congratulations for the job done with this new tool!

I'm a Silverlight developer and I need to display a ressource planning using 2 groups. The native scheduler isn't able to do this, that's why i just tried this new scheduler for wpf.
It seems to be well working, but I have several questions:

- Is it possible to change the date format in a timeline view? In my case I need to display days and not hours since I want to display a 2-months planning.
I used to set the "TimeLineHeaderFormat" in the RadScheduler control, but it doesn't seem to exist anymore.

- When my groups are displayed horizontally, their title are displayed vertically. Is it possible to change the orientation of the text?

- Furthermore, is it possible to change the content of the group header? I mean I would add an image of the concerned ressource in the header.

I just added a screenshot to illustrate my questions.

Thank you for your answer.

Best Regards,

Julien LOFFICIAL
Pana
Telerik team
 answered on 04 Nov 2010
3 answers
384 views
Hello,

I am trying to use RadGridView in one project but I have been experiencing some difficulties

Basically I have a GridView with ItemSource binding to my list of items.

Problem is data, when I try to add a new row to the grid, using BeginInsert method,
instead of start editing the new row, the grid starts editing a blank cell on the previous row (this cell can be left blank)

Also sometimes when a row enters in editing mode, doesn't matter what I do (press insert key, etc..)
it stays this way...

P.S: Just to notice that  I am using MVVM, so all the events are made by use of Commands

Thanks a lot

Nedyalko Nikolov
Telerik team
 answered on 04 Nov 2010
1 answer
112 views
Hi,

I am actually evaluating a powerful grid and I am choosing between the yours, the devexpress one and xceed.

Everything is working fine except one problem :

I am modeling data using entity framework. In my modeling, the class 'Collaborator' is teh base class for the other class 'User'.

I am getting coll which is the collection of type 'Collaborator'. So, the collection will contain instances of both classes.

If I bind the grid to a collectionviewsource created on coll I get blank rows and sometimes exceptions are thrown. (an Observable collection is created as an intermediary object).

If I bind directly to coll everything goes well.

So, what's the problem ?

Best regards
Pavel Pavlov
Telerik team
 answered on 04 Nov 2010
1 answer
244 views
I am using RadTreeView to display a hierarchy of different objects. Each object in the tree may have an object specific context menu or no context menu at all. The problem is if I set a context menu on a node in the tree all of the children of that node in the treeview display the same context menu unless I explicitely set a different context menu for the child node. This works fine if the child node has a context menu, but if it does not I always get the parent node's context menu which generally does not apply to this node. Explicitly setting the child node's context menu to null does not help. So I can not have tree nodes with no context menu that are children of a tree node that has a context menu. Is there any way around this?
George
Telerik team
 answered on 04 Nov 2010
3 answers
143 views
Hi,

I use this code for setting a custom range for AxisY in my chart, but only last range apply in chart and other range clear by it.

radchart.DefaultView.ChartArea.AxisY.AutoRange = false;
radchart.DefaultView.ChartArea.AxisY.AddRange(0, 100000000, 100000000 / 4);
radchart.DefaultView.ChartArea.AxisY.AddRange(100000000, 1000000000, (1000000000 - 100000000)/4);
radchart.DefaultView.ChartArea.AxisY.AddRange(1000000000, max2, (max2 - 1000000000) / 2);
Evgenia
Telerik team
 answered on 04 Nov 2010
1 answer
100 views
How to change the image of Alert, prompt or cofirm? The image, no the icon
Thanks

PD: Sorry form my english
Konstantina
Telerik team
 answered on 04 Nov 2010
7 answers
196 views
I have some windows that I am creating programmatically.  I found the RadDocking.SetSerializationTag() method to set the tag, but when I open my windows from the radDocking.LoadLayout() the code loaded windows do not have controls on them.  If I do not call the layout function, then everything is loaded just fine.  Here is my code:
RadPane redlineBottomPane = new RadPane();
 
redlineBottomPane.Name = "rpnBottomRedline";
redlineBottomPane.Header = "Redline Sessions";
redlineBottomPane.Title = "Redline Sessions";
redlineBottomPane.CanUserClose = false;
redlineBottomPane.CanDockInDocumentHost = true;
redlineBottomPane.IsPinned = true;
 
Telerik.Windows.Controls.RadDocking.SetSerializationTag(redlineBottomPane, "RedlinePluginPane");

Please let me know what is wrong with this.  Thanks in advance.
George
Telerik team
 answered on 04 Nov 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
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?